Python Simple HTTP-SERVER

علی ذوالفقار
1399/02/29 20:27:24 (754)
to run a simple http-server you can use paython
pythone 2.X : python -m SimpleHTTPServer 8000
pythone 3.X : python -m http.server 8000
8000 is the port which http-server will listen

or create a python script like this :
server.py
import http.server
import socketserver
PORT = 8000
handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), handler) as httpd:
    print("Server started at localhost:" + str(PORT))
    httpd.serve_forever()

Back