apache 部署web.py

來源:互聯網
上載者:User

標籤:

一.安裝Mod_wsgi1.先yum -y install httpd-devel,否則會提示沒有apxs2.如果在make時 wsgi報錯apxs:Error: Command failed with rc=65536,那要在configure時加上--with-python=xxxx這個參數3.解壓Mod_wsgi如果自訂升級過了python到2.7#./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/python27/bin/python2.7如果是預設python:#./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/bin/python2.6#make#make install根據提示執行#chmod 755 /usr/lib64/httpd/modules/mod_wsgi.so4.安裝web.py二、部署web.py網站1.將網站拷貝到/var/www/html中,網站名稱WebpyTest2.修改httpd.conf#vi /etc/httpd/conf/httpd.conf,在末尾加入 LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /WebpyTest /var/www/html/WebpyTest/Code.py/Alias /appname/static /var/www/webpy-app/static/   #沒的話可以不加
AddType text/html .py
<Directory /var/www/html/Webpytest/>
    Order deny,allow
    Allow from all
</Directory> 3.修改Code.py在定義class上方加上:application = web.application(urls, globals()).wsgifunc()同時“if __name__ == ‘__main__‘:”這段代碼可以刪除 注意:1.引用模版的路徑,最好加上是render = web.template.render(os.getcwd()+"/templates/") 這樣能擷取完整的路徑 

參考:http://webpy.org/cookbook/mod_wsgi-apache.zh-cn

附件:

https://app.yinxiang.com/shard/s41/res/6b8ce786-62eb-46de-8fb4-4a09e0f594b8/web.py-0.37.tar.gz

apache 部署web.py

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.