【发布时间】:2017-09-11 18:02:15
【问题描述】:
我在我的 centos 生产服务器(centos 6.5)中安装了 django(1.11) 和 python 3.5 和 virtualenv
当我使用 python manage.py runserver 在本地启动 django 时,我可以使用 django,但我不能在 apache 上使用 mod WSGI 服务我的 django 我在 /conf.s/django.conf 上测试了非常不同的配置,但我遇到了这个错误:
mod_wsgi (pid=5713): Target WSGI script '/var/www/path/to/site/myapp/wsgi.py' cannot be loaded as Python module.
这是我在 /etc/httpd/conf.d/django.conf 中的 django.conf
<VirtualHost *:80>
WSGIProcessGroup myapp
WSGIDaemonProcess myapp display-name=%{GROUP}
ServerName test.com
ServerAlias www.test.com
ServerAdmin email@gmail.com
DocumentRoot /path/to/root
WSGIScriptAlias / /path/to/root/myapp/wsgi.py
Alias /static /path/to/root/myapp/static
ErrorLog /path/to/error.log
CustomLog /path/to/access.log combined </VirtualHost>
我该如何处理这个问题?
【问题讨论】:
-
你是如何安装 mod-wsgi 的?它必须针对某个 Python 版本进行编译。如果你安装了 yum,我猜你从 yum 得到了一个非常过时的 Python 2 版本。
-
是的,wsgi 是用 yum 安装的,我如何为 python 3.5 编译 wsgi?
标签: python django apache centos wsgi