Chapter 2. Some Frameworks to Keep an Eye On
As we have seen, there are many Python web frameworks to choose from. In fact, there are too many to be able to cover every one in detail in this report. Instead, we will take a deeper look at six of the most popular. There is enough diversity here to give the reader some idea about how different frameworks work and what a web application’s code looks like when using them.
For each framework, we are going to give a general description, discuss some key features, look at some sample code, and talk a bit about when it should be used. When possible, code for a simple single-file application will be shown. Quick start instructions assume Python and pip
or easy_install
are present on the system. It is also recommended that you use virtualenv
(or pyvenv
for Python 3.3+) to create an isolated environment for your application. For simplicity, the examples do not show the setup of pip
and virtualenv
. See Appendix A for help with any of these tools.
Django
Django is without a doubt the most popular web framework for Python at the time of this writing. Django is a high-level framework, designed to take care of most common web application needs.
Django makes a lot of decisions for you, from code layout to security. It’s also very well documented, so it’s very easy to get a project off the ground quickly. There are also many third-party applications that can complement its many features nicely.
Django is very well-suited for database-driven web ...