How to quickly build a web.py development framework under Windows

Source: Internet
Author: User

With Python for web development There are many frameworks to choose from, such as the most famous Django,tornado, and in addition to these frameworks, there is a lightweight framework to use is very convenient and handy, is web.py. It was created by a hacker, but unfortunately the founder committed suicide in 2013. It is said that it is now maintained and updated by another person. Find out how to build the web.py development environment under Windows now.

I. Installation web.py

Download the web.py installation package on the https://github.com/webpy/webpy. Note that GitHub has requirements for the browser version, such as not supporting IE9 below.

  

Download the appropriate version yourself as needed.

After downloading, unzip, open CMD,CD to unzip the directory, enter

Python setup.py Install

The installation is complete. (If you have to install Python,python3 versions below)

Two. Test the program.

Create a hello.py file

123456789101112 import web urls = (‘/hello‘, ‘hello‘,       )class hello(object):  def GET(self):    return ‘hello world‘if __name__ == "__main__":  app = web.application(urls, globals())  app.run()

URLs are URL mapping rules (similar to mappings in Servlets), and class Hello is a link request response.

Then run the file under the command line:

  

If you want to stop the program CTRL + C, you can exit. The default program runs on port 8080, and then in the browser: Http://127.0.0.1:8080/hello, you can see the results:

  

The program runs on port 8080 by default, and if the 8080 port is occupied by another program, the web.py program fails, such as a sockets.error error, which requires the port to be changed:

  

  

Note web.py does not have the ability to deploy Web sites, so for web.py programs you can only access them locally, and if you want to deploy it you must use Apache or Nginx.

How to quickly build a web.py development framework under Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.