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. 

  

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐