简体   繁体   English

使用apache,mod_wsgi,windows运行django的选项

[英]Options for running django with apache, mod_wsgi, windows

I have a working django project, build with: 我有一个正在运行的django项目,其构建如下:

python 2.7  
windows  
apache 2.2  
mod_wsgi 

I've used to download apache binary from: https://www.apachelounge.com/download/ 我曾经从以下网址下载apache二进制文件: https : //www.apachelounge.com/download/

Unfortunately, apache lounge has stopped building binaries with VC9 (since mid jan, according to the forum), which is the version of VS that python 2.7 is compiled with. 不幸的是,apache lounge已停止使用VC9构建二进制文件(根据论坛,自1月中旬以来),这是python 2.7编译所用的VS版本。
As I've said my current setup is with apache 2.2, VC9 binary, downloaded from apache lounge. 就像我说过的,我当前的设置是从apache lounge下载的apache 2.2(VC9二进制文件)。 But I don't have this .msi anymore (probably deleted it, as I usually do with .msi files after I install them). 但是我没有这个.msi了(可能删除了它,就像我通常在安装.msi文件后所做的那样)。
So I can't setup apache+mod_wsgi with django in another windows server. 所以我不能在另一台Windows服务器上用django设置apache + mod_wsgi。

What are my options? 我有什么选择? I'm willing to upgrade to apache 2.4, but there is no binary built with VC9, and according to this page: 我愿意升级到Apache 2.4,但是没有使用VC9构建二进制文件,并且根据此页面:
https://github.com/GrahamDumpleton/mod_wsgi/tree/develop/win32 mod_wsgi binary must match to the VS version used to compile python and apache. https://github.com/GrahamDumpleton/mod_wsgi/tree/develop/win32 mod_wsgi二进制文件必须与用于编译python和apache的VS版本匹配。

Suggestions would be appreciated. 建议将不胜感激。

You can run django as a stand-alone process and then use mod_proxy to redirect requests to it from apache, while letting apache serve the static files itself. 您可以将django作为独立进程运行,然后使用mod_proxy将请求从apache重定向到它,同时让apache为其提供静态文件本身。 My wsgi server of choice is gunicorn, but it's not available on windows. 我选择的wsgi服务器是gunicorn,但在Windows上不可用。 While frowned upon, it is also possible to use the django built-in server in production as long as the static resources are not handled by it as described earlier. 虽然不赞成,但也可以在生产环境中使用django内置服务器,只要它不处理静态资源(如前所述)即可。 I've got a site running using this method right now, and it works just fine. 我现在有一个使用此方法运行的网站,它工作正常。

Reverse proxies communicate with the backend server via sockets, so VC mismatch is not an issue. 反向代理通过套接字与后端服务器通信,因此VC不匹配不是问题。 Here's a tutorial for setting it up . 这是设置它的教程

Of course, ideally, you should move away from windows servers if you're not using IIS or other windows-specific technology. 当然,理想情况下,如果您不使用IIS或其他Windows特定技术,则应该远离Windows服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM