Quickly build a web. py development framework in windows.

Source: Internet
Author: User

Quickly build a web. py development framework in windows.

There are many frameworks to choose from for web development using Python, such as the most famous Django and tornado frameworks. In addition to these frameworks, it is very convenient and convenient to use a lightweight framework, web. py. It was created by a hacker, but unfortunately the Creator committed suicide in 2013. It is said that another person is maintaining and updating the service. Now let's take a look at how to build a web. py development environment in windows.

1. Install web. py

Download the web.pyinstallation package at https://github.com/webpy/webpy. Note that github requires a browser version, for example, less than IE9 is not supported.

Download the corresponding version as needed.

Download the package, decompress it, open cmd, cd to the decompressed directory, and enter

Python setup. py install

The installation is complete. (Python and python 3 or earlier must be installed)

Ii. test procedures.

Create a hello. py file

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 is a url ing rule (similar to the servlet ing in servlet), and hello is a link request response.

Then run the file in the command line:

If you want to stop the program Ctrl + C, you can exit. By default, the program runs on port 8080. Then, enter http: // 127.0.0.1: 8080/hello in the browser to view the result:

The program runs on port 8080 by default. If port 8080 is occupied by other programs, the web. py program fails to run. For example, the sockets. error occurs. You need to change the Port:

Note that web. py does not support website deployment. Therefore, web. py programs can only be accessed locally. apache or nginx must be used for deployment.

Related Article

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.