mod_wsgi和Django的错误:读取从守护进程获取响应头时超时

2024-09-27 18:18:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我运行的是Django 2.0.4和mod\wsgi4.5.20。在

当我试图将站点部署到位于/parature的开发环境时,遇到了一个错误。奇怪的是,部署在VirtualHost根目录下的站点响应正常:

[Tue Apr 10 13:34:08.998704 2018] [wsgi:error] [pid 65245] [client xx.yy.zz:65390] Timeout when reading response headers from daemon process 'parature-develop-https': /var/django/html/parature-develop/config/wsgi.py

我可以通过激活的runserver运行站点。这不应该是超时,因为我只是想打开Django管理网站。在

^{pr2}$

我觉得我错过了一些显而易见的东西,但看不见。我在另一个VirtualHost中有一个类似的配置,在同一个域下有多个Django项目,只要根站点在最后,这个配置就可以正常工作。在

wsgi.py与正在工作的站点几乎完全相同:

import os, sys, logging
from socket import gethostname
from django.core.wsgi import get_wsgi_application

# Since this powers Apache, let's route Python errors to the Apache
# log rather than STDOUT, where they'll never be seen.
logging.basicConfig(stream=sys.stderr)

# Figure out where we're at, and add the parent to the path
sys.path.append(os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2]))

# wrds-pub1-dev server
if 'wrds-pub1-dev' in gethostname():
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
# wrds-pub* production servers.
elif 'wrds-pub' in gethostname():
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
# else use dev settings.
else:
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_wsgi_application()

有什么想法吗?在


Tags: thepathdjangofromimportconfigwsgisettings
1条回答
网友
1楼 · 发布于 2024-09-27 18:18:13

我发现了这一点——我们的开发服务器(因为从来没有一个好的重建时间)是我们唯一的非Ansibled服务器,并且仍然在运行基于Python3.5构建的mod_wsgivirtualenv是根据python3.6构建的。在

我根据python3.5重新构建了virtualenv,一切正常。希望这能为将来的人们省去麻烦!在

相关问题 更多 >

    热门问题