mod_wsgi windows 7 64位安装问题
问题描述:
我得到这个错误,在Windows 7家庭主版64位环境。 我曾尝试过许多不同的方式,如apache文档中所述。 在httpd.conf中我有以下 环境Python 3.4,apache 2.4.25 mod_wsgi py25 vc10 64位。此外,我试图通过CGI运行Python代码 ,它工作正常。mod_wsgi windows 7 64位安装问题
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonEggs /apache2423/Apache24/htdocs
WSGIScriptAlias /wsgi /apache2423/Apache24/htdocs/wsgi.py
WSGIPythonPath /Python34
<Directory /apache2423/Apache24/htdocs/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
的代码是:
#!/Python34/python
import os
import subprocess
os.environ['PYTHON_EGG_CACHE'] = '/Apache245/Apache24/htdocs'
def application(environ, start_response):
status = '200 OK'
output = b'<html> ... Hello World of Django ...</html>'
response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
答
。假定该mod_wsgi.so
文件是正确的Apache的模块目录,改变你的Apache配置:
LoadFile /Python34/DLLs/python3.dll
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /Python34
WSGIScriptAlias /wsgi /apache2423/Apache24/htdocs/wsgi.py
<Directory /apache2423/Apache24/htdocs/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
确认:
/Python34/DLLs/python3.dll
确实存在。它应该是Python 3.4 DLL的位置。
推测您的Python 3.4安装在/Python34
下。
LoadFile
行的要点是强制加载Python DLL。您收到的错误也可能表示它是由mod_wsgi.so
引用的DLL在任何标准位置均未找到。
WSGIPythonHome
告诉mod_wsgi Python安装的位置。请注意,它不是像您一样的WSGIPythonPath
。
您用来访问应用程序的URL将是http://localhost/wsgi
。
什么是错误?你在哪里看到这个错误? Apache错误日志中有哪些消息? –
我曾尝试运行此代码。 #!/ Python34 /蟒 进口OS 进口子 os.environ [ 'PYTHON_EGG_CACHE'] = '/ Apache245/Apache24/htdocs中' DEF应用(ENVIRON,start_response): 状态= '200 OK' 输出= b' ... Django的Hello World ...' response_headers = [('Content-type','text/plain'), ('Content-Length',str(len(output) ))] start_response(status,response_headers) return [output] – waldron
那仍然没有回答问题是什么,在哪里看到任何错误等。有关错误的详细信息是必需的。没有细节就无法猜测。 –