apache2部署django出现了错误

发布于 2022-09-06 06:29:31 字数 4703 浏览 18 评论 0

环境:centos6.5,django 1.11,python3.6,
使用conda 虚拟环境

我的wsgi文件:

import os
from os.path import dirname, abspath

from django.core.wsgi import get_wsgi_application

import sys

PROJECT_DIR = dirname(dirname(abspath(__file__)))
# sys.path.append('/home/comengine')
sys.path.insert(0,PROJECT_DIR)
# sys.path.append('/root/soft/anaconda3/envs/compoengine/lib/python3.6/site-packages')

# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "comengine.settings")

os.environ["DJANGO_SETTINGS_MODULE"] = "comengine.settings"

application = get_wsgi_application()

我的httpd.conf:


ServerRoot "/usr/local/apache2"

ServerName localhost:8001


Listen 8001
Listen 5090

LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule rewrite_module modules/mod_rewrite.so

WSGIApplicationGroup %{GLOBAL}

Include conf/extra/httpd-vhosts.conf

<IfModule unixd_module>
User daemon
Group daemon

</IfModule>


ServerAdmin you@example.com


<Directory />
    AllowOverride none
    Require all granted
</Directory>


DocumentRoot "/usr/local/apache2/htdocs"
<Directory "/usr/local/apache2/htdocs">
    Options Indexes FollowSymLinks

    AllowOverride None

    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" common

</IfModule>

<IfModule alias_module>


    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule headers_module>
    RequestHeader unset Proxy early
</IfModule>

<IfModule mime_module>
    TypesConfig conf/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz



</IfModule>
















<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


我的httpd-vhosts.conf:

<VirtualHost *:5090>
    ServerName localhost:8001
    ServerAdmin ahome@163.com

    DocumentRoot "/home/comengine/comengine"

    # WSGIPythonPath /root/soft/anaconda3/envs/compoengine/lib/python3.6/site-packages
    WSGIScriptAlias / /home/comengine/comengine/wsgi.py
    WSGIDaemonProcess comengine python-home=/root/soft/anaconda3/envs/compoengine/lib/python3.6/site-packages
    WSGIProcessGroup comengine

    <Directory /home/comengine/comengine>
    <Files wsgi.py>
        Require all granted
    </Files>
    </Directory>

    ErrorLog /usr/local/apache2/logs/error-comengine.log
    CustomLog /usr/local/apache2/logs/access-comengine.log combined

</VirtualHost>
WSGISocketPrefix /usr/local/apache2/run/wsgi

最后却出现这样的错误log:

Timeout when reading response headers from daemon process 'comengine': /home/comengine/comengine/wsgi.py

这是怎么回事?该怎么办?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文