Python Web Programming
docs.python.org
docs.python.org
(I'm not sure why you would want to do that, because Flask comes with Werkzeug, which is better integrated and I trust its author a bit more.)
Also, I've never seen a better documentation than Flask's.
Well for one, Cherrypy-the-web-server is actually good enough for production. There is much to be said for the benefits of having the same deployment environment in development and production.
The development server is not intended to be used on production systems. It was designed especially for development purposes and performs poorly under high load. For deployment setups have a look at the Application Deployment pages.
So, in the end, I end up mimicking the basic structure of a Django project: Models, Views, Forms, Utilities, etc. Yes, different ORM, different Form library, WSGI middleware instead of context processors, etc., but all-in-all, no less complex than had I used Django. It's really to the point that I find it hardly any faster to code in Flask for all but the most basic sites.
I still use Flask for super simple projects that require no Admin interface, such as Personalized URL sites for ad campaigns. So it certainly has it's place.
I don't want to disagree on something I don't have much experience with, but at the same time, I'd like to hear more about how you build your projects.
(In addition, considering there are two viable options for plug-and-play Flask admin interfaces, I don't know why you made it sound difficult.)
And then there are other things such as having all of your URLs specified on one place vs. as decorators with your controllers. But that's just my personal preference.
However, I have also found the tools around Django's ORM to be quite useful (admin, south).
The part I really like about Flask is the decorators for routes. This is how it should be, not some messy file of reg-exes.
I totally agree about the regexes: only a small subset of all routes will ever need regexes, and you can do it explicitly in Flask when needed.
For example, Django's ORM has no concept of explicit joins for example, which are necessary for avoiding O(n) # of queries in several cases. The only way to do it is to write SQL, whereas with SA the query is trivial to write in Python.
You can do stuff like Teacher.objects.all().select_related('students') and Teacher.objects.filter(students__first_name='Jill').
The biggest frustration is aggregation though. It has hard and sometimes impossible to add group by and having clauses. Using extra() is very fragile and using values to force the group by is awkward. There is probably no fixing that part of the Django ORM other than just getting rid of it.
I've been pondering implementing a Django ORM backend that just delegates to the relevant SQLAlchemy functions. I think it may be way harder than it seems, though.
Apache2 + mod_wsgi in Daemon mode is probably the most common approach (especially for VPSs), although I know several people who prefer nginx + gunicorn + supervisor. Both are sane and stable options at this point. (The python web frameworks themselves all speak WSGI and there are about seventeen million of 'em to choose from.)
[2] http://modwsgi.googlecode.com/files/mod_wsgi-pycon-sydney-20...
Needless to say, there are some great Python web servers and frameworks out there that aren't listed on that page.
[1] http://www.tornadoweb.org/
Edit: Added links
So it may not have been the best resource to present on HN in the first place.
To your point, I'd be curious to see a non-Tornado server that is Tornado compatible on the backend. It could be an interesting project. I would counter, however, that any server choice has its own inertia--changing web servers is hardly ever a simple process.
* I wish there was a one-file jinja copycat to make it easier to just drop bottle and jinja and start hacking.
Moreover, I don't think the barrier of entry to use Tornado, for example, is significantly higher than Bottle, and you can use it for any sized project. I realize that is both a server and framework, but truthfully I guess I'm also wary of WSGI on the whole and wouldn't recommend anyone even start down that rabbit hole in this day and age.
I thought long and hard about the "Should I learn Django or Turbogears" question 3 or four years ago, and went with Django. Back then, Django was not yet the "default" answer.
If I could just say <?coffeescript like that, my programmer-happiness rating would quadruple instantly.
One big plus for Python Server Pages is the ability to pre-compile into bytecode. True Python doesn't have near the level of compile-time checking that Java does, but it that could be written into a framework...
If someone knows of something similar, please let me know.
https://docs.djangoproject.com/en/dev/intro/tutorial01/
If you don't like that one, there are even more: https://code.djangoproject.com/wiki/Tutorials
Here are some others:
- Python/C API Reference Manual http://docs.python.org/py3k/c-api/
- Higher-order functions and operations on callable objects http://docs.python.org/library/functools.html
- Google http://www.google.comIt there's no Python news, that doesn't mean you should post random tutorials instead. This is getting tiresome. Flagged.
Fortunately he's one of the awesome, awesome people I can just point at an article and he'll be off and running.
Are there any HTTP servers written in Python (rather than modules)? I'm struggling to think of any.
A couple of other pure-python (I think) HTTP servers that haven't come up in this thread yet are twisted and paster.
As a side note, I find it interesting that the Django Book does not contain a chapter on test writing.