標籤:wsgi
wsgi (web server gateway interface)
官方文檔:
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/
1、安裝wsgi
[[email protected] ~]# yum install mod_wsgi
2、修該django.py設定檔
[[email protected] conf.d]# vim /etc/httpd/conf.d/django.conf
<VirtualHost *:80>
WSGIDaemonProcess simplecmdb-wsgi python-path=/opt/python/django/simplecmdb-wsgi:/opt/amos/lib/python2.7/lib/python2.7/site-packages/
WSGIProcessGroup simplecmdb-wsgi
WSGIScriptAlias / /opt/python/django/simplecmdb-wsgi/simplecmdb/wsgi.py
Alias /static /opt/amos/lib/python2.7/lib/python2.7/site-packages/django/contrib/admin/static
</VirtualHost>
<Directory /opt/python/django/simplecmdb-wsgi/simplecmdb>
Order allow,deny
Allow from all
</Directory>
WSGISocketPrefix /var/run/wsgi
3、重啟Apache
[[email protected] conf.d]# /etc/init.d/httpd restart
停止 httpd: [確定]
正在啟動 httpd:httpd: Could not reliably determine the server‘s fully qualified domain name, using 0.0.0.133 for ServerName
[確定]
4、訪問報錯
首先是報錯500,查看日誌:
no module name MySQLdb
參考部落格:http://daixuan.blog.51cto.com/5426657/1909143 安裝MySQLdb
之後重啟apache
5、訪問:
650) this.width=650;" src="https://s2.51cto.com/wyfs02/M00/8F/72/wKiom1jeUuXSU3HiAAErQzfj5As650.png-wh_500x0-wm_3-wmp_4-s_3159700741.png" style="float:none;" title="C3CECCC0-01D4-4FB4-8FC4-81D2980295E1.png" alt="wKiom1jeUuXSU3HiAAErQzfj5As650.png-wh_50" />
650) this.width=650;" src="https://s1.51cto.com/wyfs02/M01/8F/72/wKiom1jeUxjwMmnXAABybwT7TF0974.png-wh_500x0-wm_3-wmp_4-s_1507243278.png" title="1344003F-4890-4798-ABFB-04C8506812CA.png" alt="wKiom1jeUxjwMmnXAABybwT7TF0974.png-wh_50" />
本文出自 “梅花香自苦寒來!” 部落格,請務必保留此出處http://daixuan.blog.51cto.com/5426657/1912244
wsgi(django與apache整合)