Django (web framework)

From Wikipedia, the free encyclopedia

Django
Image:Djangologo.gif

The default Django page
Developer: Lawrence Journal-World
Latest release: 0.95 / July 29, 2006
Use: Web application framework
License: BSD License
Website: www.djangoproject.com

Django is an open source web application framework, written in Python, which loosely follows the model-view-controller design pattern. It was originally developed to manage several news-oriented sites for the World Company of Lawrence, Kansas, and was released publicly under a BSD license in July 2005; the framework was named after gypsy jazz guitarist Django Reinhardt. The current stable version of Django is 0.95.

Contents

[edit] Overview

Django emphasizes reusability and "pluggability" of components, with an emphasis on providing generic or dynamic tools and building blocks; for example, rather than generate static view or template files to handle common operations, Django provides a set of "generic views" which can be adapted at runtime to suit various purposes. Django also provides a dynamically-generated administrative interface (included in an application bundled with the main download) which can be changed at runtime by directives contained in model classes.

While several design patterns such as the model-view-controller architecture and principles such as loose coupling of components appear in Django, the framework does not strictly adhere to any particular pattern or philosophy, and does deviate notably where the developers feel it to be appropriate; for example, there is no component which exactly corresponds to the "Controller" portion of the Model-View-Controller pattern, and the internal dispatcher may be viewed as a variation of the observer pattern but does not strictly conform to that pattern.

[edit] Components

The core Django framework consists of an object-relational mapper which mediates between data models (defined as Python classes) and a relational database; a regular-expression-based URL dispatcher; and a view and templating system.

Also included in the core framework are:

  • A form serialization and validation system which can translate between HTML forms and values suitable for storage in the database.
  • A caching framework which can use any of several cache methods.
  • Support for middleware classes which can intervene at various stages of request processing and carry out custom functions.
  • An internal dispatcher system which allows components of an application to communicate events to each other with each other via pre-defined signals.
  • An internationalization system, including translations of Django's own components into a variety of languages.
  • A serialization system which can produce and read XML and/or JSON representations of Django model instances.
  • A system for extending the capabilities of the template system by writing and registering custom functions for use in templates.

[edit] Bundled applications

The main Django distribution also bundles a number of applications in its "contrib" directory; among them are:

  • The dynamic administrative interface.
  • An extensible authentication system.
  • Tools for generating RSS and Atom syndication feeds.
  • A generic commenting system.
  • A lightweight, standalone web server for server-independent development and testing.
  • Tools for generating Google Sitemaps.
  • Tools for preventing cross-site request forgery.
  • Tools for allowing one Django installation to manage multiple websites.
  • Template libraries which enable the use of lightweight markup languages such as Textile and Markdown.

[edit] Server arrangements

Django can run on Apache under mod_python, or under any WSGI-compliant web server. Django also includes the ability to launch a FastCGI server, enabling use behind any web server which supports FastCGI.

The following databases are officially supported for use with Django:

Adapters for Microsoft SQL Server and Oracle are under development, but are still experimental.

[edit] See also

[edit] External link