命令WSGIDaemonProcess Deploy Django application on CentOS 6.7无效

2024-05-21 20:28:50 发布

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

我正在使用Django 1.8onCentOS 6.7Apache服务器版本:Apache/2.2.15(Unix)。

我已经遵循了How To Serve Django Applications with Apache and mod_wsgi on CentOS 7.中的步骤 但在最后一步,当我用命令service httpd start而不是systemctl start httpd启动Apache服务器时,因为根据教程,我有Centos 6.7而不是Centos 7。

出现以下错误:

Starting httpd: Syntax error on line 10 of /etc/httpd/conf.d/django.conf:
Invalid command 'WSGIDaemonProcess', perhaps misspelled or defined by a module ot included in the server configuration

您可以在这里查看django.conf:

Alias /static /home/ftpispy/ispy/static
<Directory /home/ftpispy/ispy/static>
    Require all granted
</Directory>
<Directory /home/ftpispy/ispy/ispy>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>
WSGIDaemonProcess ispy python-path=/home/ftpispy/ispy:/home/ftpispy/ispy/venv/lib/python2.7/site-packages
WSGIProcessGroup ispy
WSGIScriptAlias / /home/ftpispy/ispy/ispy/wsgi.py

提前谢谢。请建议在CentOS 6.7上使用djnago 1.8部署任何其他选项。


Tags: djangowsgihomeonapacheconfstaticstart
3条回答

通过运行

sudo a2enmod wsgi

如果未安装,请执行以下命令进行安装

对于Python2

sudo apt-get install python-pip apache2 libapache2-mod-wsgi

Python3号

sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3

我也有类似的错误

Invalid command 'WSGIDeamonProcess', perhaps misspelled or defined by a module not included in the server configuration

因为忘记在路径前写“/

WSGIScriptAlias / /var/www...

应该为Apache启用mod_wsgi模块。确保在/etc/apache2/mods-enabled/中设置了指向wsgi.conf/etc/apache2/mods-available/wsgi.load的符号链接。

另一方面,查看最新一代的^{},它提供了一种使用简单工具mod_wsgi-express(无需设置httpd配置)启动wsgi应用程序的便捷方法。

相关问题 更多 >