wsgi(django與apache整合)

來源:互聯網
上載者:User

標籤: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整合)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.