wsgi
生产环境不需要启动开发服务器,django随着apache一起启动
安装模块
yum install httpd
yum search mod_wsgi
yum install mod_wsgi
cat /etc/httpd/conf.d/django.conf
<VirtualHost *:80>
WSGIDaemonProcess simplecmdb python-path=/opt/simplecmdb:/usr/local/lib/python2.7/site-packages/django
WSGIProcessGroup simplecmdb
WSGIScriptAlias / /opt/simplecmdb/simplecmdb/wsgi.py
Alias /static /usr/local/lib/python2.7/site-packages/django/contrib/admin/static
#Alias /static /opt/simplecmdb/static
</VirtualHost>
<Directory /opt/simplecmdb/simplecmdb>
Order allow,deny
Allow from all
</Directory>
WSGISocketPrefix /var/run/wsgi
报错
apache的error_log
[Mon Dec 25 19:20:13 2017] [error] [client 192.168.17.1] from django.core.wsgi import get_wsgi_application
[Mon Dec 25 19:20:13 2017] [error] [client 192.168.17.1] ImportError: No module named django.core.wsgi
# vim /opt/simplecmdb/simplecmdb/wsgi.py
import os,sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
posted on 2018-01-10 21:10 linux-paul 阅读(105) 评论(0) 编辑 收藏 举报