Making a website with just python standard library

PORT = 9999

class myhttprequesthandler(http.server.SimpleHTTPRequestHandler):

def do_GET(self):
    # This will serve the HTML content
    self.send_header('Content-type', 'text/html')
    # HTML content of the webpage
    html = '''
    <!DOCTYPE html>
        <title>My Simple Page</title>
        <h1>Welcome to My Simple Page</h1>
        <p>This is a single page website created using Python's standard library.</p>

Now you just set the handler

handler_object = MyHttpRequestHandler

Then Just bring it all together and make sure that you create a tcp server using the socket server

with socketserver.TCPServer(("", PORT), handler_object) as httpd:
    print("Server started at localhost:" + str(PORT))

Once you’ve got all this code completed you will be able to modify this code in order to expand the information.

Publish your writings here!

We are always looking to publish your writings on the pyATL website. All content must be related to Python, non-commercial (pitches), and comply with out code of conduct.
If you’re interested, reach out to the editors at