Django is Python's most popular full-stack web framework, described as "the web framework for perfectionists with deadlines." Created by Adrian Holovaty and Simon Willison at the Lawrence Journal-World newspaper, Django follows the "batteries included" philosophy: it provides an ORM (Object-Relational Mapper), a template engine, an admin interface, URL routing, form handling, authentication, security middleware, and database migrations out of the box.
Django follows the MTV (Model-Template-View) pattern, analogous to MVC. Models define database tables as Python classes using the ORM. Templates render HTML with a custom template language. Views (functions or classes) handle HTTP requests and return responses. The framework emphasises convention over configuration, DRY (Don't Repeat Yourself), and rapid development.
Django powers some of the web's largest sites — Instagram, Pinterest, Mozilla, Disqus, and the Washington Post all use it. The Django REST Framework extends it for building APIs. Django's admin interface — automatically generated from your models — is one of its most distinctive features, providing a production-ready CRUD interface with minimal code. For projects that need a full-featured web application with user authentication, a database, and an admin panel, Django is the natural choice.
Discussed in:
- Chapter 20: The Python Ecosystem — Web Frameworks