Web Framework

A web framework is a code library that makes a developer’s life easier when building reliable, scalable and maintainable web applications.

Why are web frameworks necessary?

Web frameworks encapsulate what developers have learned over the past twenty years while programming sites and applications for the web. Frameworks make it easier to reuse code for common HTTP operations and to structure projects so developers with knowledge of the framework can more quickly build and maintain the application.

Common web framework functionality

Frameworks provide functionality in their code or through extensions to perform common operations required to run web applications. These common operations include:

  • URL routing
  • HTML, XML, JSON, and other output format templating
  • Database manipulation
  • Security against Cross-site request forgery (CSRF) and other attacks

Not all web frameworks include code for all of the above functionality. Frameworks fall somewhere between simply executing a single use case and attempting to be everything to every developer with increased complexity. Some frameworks take the “batteries-included” approach where everything possible comes bundled with the framework while others have a minimal code library that plays well with extensions.

For example, the Django web application framework includes an Object-Relational Mapping (ORM) layer that abstracts relational database read, write, query, and delete operations. However, Django’s ORM cannot work without significant modification on non-relational databases such as MongoDB. Some other web frameworks such as Flask and Pyramid are easier to use with non-relational databases by incorporating external Python libraries. There is a spectrum between minimal functionality with easy extensibility and including everything in the framework with tight integration.

General web framework resources

Web frameworks learning checklist

  • Choose a major Python web framework (Django or Flask are recommended) and stick with it. When you’re just starting it’s best to learn one framework first instead of bouncing around trying to understand every framework.
  • Work through a detailed tutorial found within the resources links on the framework’s page.
  • Study open source examples built with your framework of choice so you can take parts of those projects and reuse the code in your application.
  • Build the first simple iteration of your web application then go to the deployment section to make it accessible on the web.
Written on January 14, 2015