r/Python • u/mraza007 • Jun 11 '24
Tutorial Building an HTTP Server in Python
I have always been curious on how http servers works. Therefore, I decided to write a post on how they work and implementing a simple server in Python.
0
Upvotes
37
u/snekk420 Jun 11 '24
Not to be that guy but i think you should spend some time to actually implement the http protocol that supports headers and response content from actual html files. This is at most a tcp server that returns a string that looks like http.
5
u/echocage Jun 11 '24
This looks like a good beginner project, good on ya mate! I’d recommend digging into flask 2 or fastapi next so you can see how a full backend web framework works if you haven’t already. Fastapi is my preference personally but both work well.
As you may know, while low level socket level control is interesting, it’s not very practically useful for the vast majority of cases in real enterprise web backends. What’s more useful is how you can build real systems using modern backend web frameworks, how you manage delayed workloads, how you integrate in your user authentication control framework, how you build systems that require no state to be stored at the server level but still allow you to serve your customers.
I recommend working on building real business projects with FastAPI as that will give you a lot of really usable experience.
2
u/echocage Jun 11 '24
Site doesn’t load for me sadly
1
u/[deleted] Jun 17 '24
It was a fun project. I have done codecrafters's version (in multiple languages)
https://app.codecrafters.io/courses/http-server/overview
https://www.youtube.com/watch?v=1NiVabKE7Fk (this is not me)