我正在使用 Apache 在本地托管一个基于 Django 的网页。但是,我收到以下错误:
从守护进程“office”读取响应 header 时超时:var/www/office/office/wsgi.py。
我尝试将 WSGIApplicationGroup %{GLOBAL} 行添加到 conf 文件中,但仍然遇到相同的错误。
这是我的 .conf 文件。
WSGIPythonPath /var/www/office
ServerName office.org
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
WSGIApplicationGroup %{GLOBAL}
<VirtualHost 0.0.0.0:80>
ServerAlias www.office.org
DocumentRoot /var/www/example.com/public_html
<Directory /var/www/example.com>
Require all granted
</Directory>
<Directory /var/www/office/office>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess office python-home=/var/www/venv python-path=/var/www/office
WSGIProcessGroup office
WSGIScriptAlias /verify /var/www/office/office/wsgi.py process-group=office
ErrorLog /var/www/logs/error.log
CustomLog /var/www/logs/custom.log combined
</VirtualHost>
这是 wsgi.py 文件:
"""
WSGI config for office project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "office.settings")
application = get_wsgi_application()
最佳答案
我遇到了同样的问题,经过大量的努力和尝试不同的事情后,这个 tutorial帮助我解决了问题。
我创建并成功运行了演示项目。对我来说问题是配置文件中的路径以及使用服务器 python 版本而不是为项目创建虚拟环境。
希望对你有帮助
关于django - 即使将 WSGIApplication 组设置为 Global 后,从守护进程读取响应 header 时也会超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57936038/