Hi Python community,
Was a fairly intermediate python user (as a hobbyist not professional), but stepped away from coding for a few years to focus more on my family.
Recently, I’ve come up with a decent idea and think I’ve got enough free time to develop a webapp that will become a passive revenue steam for me.
Since the last time I’ve coded, it looks like there are quite a few new web frameworks making there way around the community. I’ve really only used flask and know/understand the difference between that and Django.
My question: are any of these new frameworks worth exploring? Is there any pros and cons list out there that compares a few against each other?
Fwiw, my project will essentially have input tables, a form a user populates, and a front end that visualizes the results (think dashboards) of a process that measures the inputs and form responses.
Appreciate any and all feedback!
What Are Your Favorite Python Frameworks for Web Development and Why?
Lihil — a high performance modern web framework for enterprise web development in python
I've created one of the Fastest Python web Frameworks!!
A (new) modern, fast, simple async python3 web framework
So, while the framework part of this might be modern, the server implementation is definitely not. I applaud your enthusiasm for writing a new HTTP server, but I really strongly recommend that you replace your parsing code with a proper server, or at least a proper HTTP parser.
I wouldn't recommend people use this server as-is in production for a few reasons:
The server is technically a HTTP/1.0 server. This is despite HTTP/1.1 having been specified in 1999.
Because it's a HTTP/1.0 server, it closes the TCP connection after each response. This means that each request incurs the hit of a TCP handshake and, for HTTPS, a TLS handshake. Except...
No TLS support, so no HTTPS.
The server makes some mistakes about framing, which mean that it can get out of step with the actual request/response cycle. In particular, it assumes that request bodies are only present on POST and PUT requests, even though none of the RFCs forbid them from being present on anything else. This means that an incautious client can confuse the server about where a request ends.
No support for line-folding in headers. This is acceptable if the server considers itself a recent HTTP/1.1 server, because line-folding got deprecated in RFC 7230, but in RFC 1945 it's still alive and well. Basically, the server doesn't support this:
GET / HTTP/1.0
Header: Part of the field
Another part of the fieldNo support for repeated header fields. For some headers it is entirely allowed to send the same header multiple times, but albatross doesn't support it because it shoves all the headers into a dict (strictly an
ImmutableCaselessDict). This is quite odd, given that there's anImmutableMultiDictdefined in the code: all you need is to create anImmutableCaselessMultiDictand you're fine.
The point of this comment is not to dump on your work: I'm glad you've done it, and more work in this space is always better! The point is simply to highlight that, while HTTP might look simple, it's really not. There are a ton of edge cases. I didn't even get into things like chunked transfer encoding, which the server also doesn't support, because of the claimed HTTP/1.0 support of the server.
I really strongly recommend you investigate either using a complete pre-written server, or that you consider using something like h11 to handle the HTTP parsing. That will let you get great HTTP/1.1 support without needing to worry about all these nasty little edge cases yourself. (And, for what it's worth, using h11 gives you a really easy jump to supporting HTTP/2 as well as HTTP/1.1, using hyper-h2).
I'll open all of these notes as bug reports as well, so that you can keep track of them. Great work!
More on reddit.comWhat is framework in Python?
What is best framework for Python?
How many Python frameworks are there?
Videos
As Python continues to be a leading language for web development, I'm interested in hearing about the frameworks that you find most effective. Whether you're building a simple blog or a complex web application, the choice of framework can greatly impact development speed and functionality. For instance, many developers swear by Django for its "batteries-included" approach, while others prefer Flask for its minimalism and flexibility. What are your go-to frameworks, and what specific features or benefits do you appreciate most about them? Additionally, do you have any tips for new developers looking to choose the right framework for their projects? Let's share our experiences and insights to help each other navigate the world of Python web development.