• apache 部署web.py


    一.安装Mod_wsgi
    1.先yum -y install httpd-devel,否则会提示没有apxs
    2.如果在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.so
    4.安装web.py
    二、部署web.py站点
    1.将站点拷贝到/var/www/html中,站点名称WebpyTest
    2.修改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

  • 相关阅读:
    Java io 理解
    Java应用的理解
    Flyweight 享元模式
    Bridge 桥梁模式
    Decrator 装饰模式
    [CF997C]Sky Full of Stars_二项式反演_等比数列_容斥原理
    [CF1010D]Mars Over_位运算性质
    [CF991D]Bishwock_状压dp
    [Agc030B]Tree Burning_贪心
    [Cometoj#4 E]公共子序列_贪心_树状数组_动态规划
  • 原文地址:https://www.cnblogs.com/biboxie/p/4233381.html
Copyright © 2020-2023  润新知