我想用 apache mod_wsgi 运行 django 站点,但是根据 django 文档,每当我在 httpd.conf 文件中写以下内容时:
WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
WSGIPythonPath /path/to/mysite.com
<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Apache 服务器无法启动,问题是 mod_wsgi 模块不存在于 apache24 模块目录中,因此以下行导致了问题
LoadModule wsgi_module modules/mod_wsgi.so
我正在尝试获取此 mod_wsgi.so 文件,但我可以在任何地方找到它。 我从下面的网址下载了 mod_wsgi-4.4.12.tar.gz 但我也无法获得 mod_wsgi.so 文件。
https://github.com/GrahamDumpleton/mod_wsgi
我尝试从 http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi 获取它但这里的文件扩展名为 .whl
在一个链接中写到我们可以在 nmake 命令的帮助下构建我们自己的 mod_wsgi.so nmake -f apXYpyXY-winNN-VC?.mk 但是在 Windows 中我得到错误 nmake is not recogiznised as a command。
请建议。我正在使用 Windows 7、Python 2.7、64 位、Apache 2.4 64 位和 Apache 2.2 32 位。
请您参考如下方法:
尝试,
LoadModule wsgi_module modules/mod_wsgi.so
DirectoryIndex index.py default.py wsgi.py
WSGIPythonPath "{$path}\python\Lib;{$path}\python\Lib\site-packages;{$path}\python\DLLs"
WSGIPythonHome "{$path}\python"
WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
让 {$path} 成为 Python 文件夹安装/所在的目录。注意 WSGIPythonPath 中的变化和 WSGIPythonHome .
您可以从这里搜索预编译的二进制文件: https://github.com/GrahamDumpleton/mod_wsgi/tree/master/win32#using-the-pre-compiled-binaries
还有 mowd_wsgi 的 Quick Configuration Guide很有帮助。
