restful Development Environement Install based on Web.py

1.Install python-language oriented web framework web.py

  1.1 Get web.py source code from official web site.

  wget http://webpy.org/static/web.py-0.37.tar.gz

  1.2 Unpack the file

  tar xzvf web.py-0.37.tar.gz

  1.3 Install web.py

  cd web.py-0.37
  python setup.py install

2.Deploy with Apache service

  2.1 Get mod_wsgi module

  yum install mod_wsgi
  2.2 modify httpd config file

    Add the following lines in the end of httpd.conf

LoadModule wsgi_module modules/mod_wsgi.so

  WSGIScriptAlias /appname /var/www/webpy-app/code.py/

  Alias /appname/static /var/www/webpy-app/static/
  AddType text/html .py

  <Directory /var/www/webpy-app/>
      Order deny,allow
      Allow from all
  </Directory>



At this moment, the web.py is deployed by apache, you can test is with the code below:

 import web

  urls = (
      '/.*', 'hello',
      )

  class hello:
      def GET(self):
          return "Hello, world."

  application = web.application(urls, globals()).wsgifunc()

FInally, open you web browser, put the url: localhost/appname/

 "Hello world." will right there. 

  

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值