Python3 using Simplehttpserver to build a Web server

Source: Internet
Author: User

Just started a thought, to use Python to make a Web server, show their own web page. So, I started my web server tour.

First, if you don't want to use Apache, IIS, you need an HTTP service, and Python comes with a simplehttpserver library to help you build an HTTP server. Of course, the library installation steps I will not write.

Where do you want to build your Web server in the file directory, you need to go into the directory using the CMD console, and then what? A soeasy step, the perfect implementation of the building.

Enter the following code in the command console:

80

Port number to see your needs, by default the port number is 8080. The console cannot be shut down and the service is stopped.

Then, if you have index.html in your directory, the page will appear.

Enter http://localhost:80/in the browser

The service is perfectly open.

Python3 using Simplehttpserver to build a Web server

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.