Selecting a Python Web Framework
This may seem like a subjective question. But it is not (that's not the idea, at least).
I'm developin开发者_JS百科g an Advertising software (like AdWords, AdBrite, etc) and i've decide to use Python. And would like to use one of those well known web frameworks (Django, Cherrypy, pylons, etc).
The question is:
Given that it will have just a few Models (seven or eight), which has the best cache support? and What is the most efficient retrieving data from a MySQL database?
Thanks!
check out Flask. Its easy, its fast, works on top of Werkzeug, uses Jinja2 templating and SQLAlchemy for the model domain. http://flask.pocoo.org/
Performance should be more or less equal. If you want to keep it simple look at cherrypy, pylons and other lightweight frameworks.
-> http://wiki.python.org/moin/WebFrameworks gives a nice overview.
If you want to use Python to do complex SQL queries on your database, e.g. eagerloading or filtering on the fly you might be wanting SQLAlchemy.
TurboGears 2 is a framework which comes with SQLAlchemy as standard, check out their caching page for more info on the second part of your answer.
CherryPy is the only framework I'm aware of that does real HTTP caching out of the box (but look at "beaker" for a WSGI component solution). Many of the others give you tools to store arbitrary objects in Memcached or other storage.
I am only familiar with Django, and can tell you that it has a very robust middleware handler and very straightforward cache management. Also, the ORM (object-relational mapper; connect objects to databases) can have Postgre or MySQL as the engine, so you are free to choose the fastest one (I think that other frameworks use SQLAlchemy's ORM, which is also super cool and fast)
Check:
- Middleware
- Cache
精彩评论