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. 

  

你可能感兴趣的:(restful Development Environement Install based on Web.py)