Jump to content

Django (web framework)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 182.72.142.186 (talk) at 06:55, 1 June 2012. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Django
Original author(s)Lawrence Journal-World
Developer(s)Django Software Foundation
Initial releaseJuly 21, 2005 (2005-07-21)
Stable release
1.4 / March 23, 2012; 12 years ago (2012-03-23)
Preview release2.2 rc1[1] (18 March 2019; 5 years ago (2019-03-18)) [±]
Repository
Written inPython
Size6 MB
TypeWeb application framework
LicenseBSD License
Websitedjangoproject.com

Django web Framework (/[invalid input: 'icon']ˈæŋɡ/ JANG-goh)[2] is an open source web application framework, written in Python, which follows the model-view-controller architectural pattern.[3] It was originally developed to manage several news-oriented sites for The World Company[4] of Lawrence, Kansas, and was released publicly under a BSD license in July 2005; the framework was named after guitarist Django Reinhardt.[5] In June 2008 it was announced that a newly formed Django Software Foundation will maintain Django in the future.[6]

Django's primary goal is to ease the creation of complex, database-driven websites. Django emphasizes reusability and "pluggability" of components, rapid development, and the principle of don't repeat yourself. Python is used throughout, even for settings, files, and data models. Django also provides an optional administrative create, read, update and delete interface that is generated dynamically through introspection and configured via admin models.

Some well known sites which use Django include Pinterest,[7] Instagram,[8] and the Public Broadcasting Service.[9] An extensive list can be found at Django Sites.

Components

Screenshot of the Django admin interface for modifying a user.

The core Django MVC framework consists of an object-relational mapper which mediates between data models (defined as Python classes) and a relational database ("Model"); a system for processing requests with a web templating system ("View") and a regular-expression-based URL dispatcher ("Controller").

Also included in the core framework are:

  • A lightweight, standalone web server for development and testing.
  • 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 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 engine.
  • An interface to Python's built-in unit test framework.

Bundled applications

The main Django distribution also bundles a number of applications in its "contrib" package, including:

  • An extensible authentication system.
  • The dynamic administrative interface.
  • Tools for generating RSS and Atom syndication feeds.
  • A flexible commenting system.
  • A sites framework that allows one Django installation to run multiple websites, each with their own content and applications.
  • Tools for generating Google Sitemaps.
  • Tools for preventing cross-site request forgery.
  • Template libraries which enable the use of lightweight markup languages such as Textile and Markdown.
  • A framework for creating GIS applications.

Server arrangements

Django can be run in conjunction with Apache using mod_wsgi or mod_python. Django can run nicely with Cherokee using flup (a Python module).[10][11] Django also includes the ability to launch a FastCGI server, enabling use behind any web server which supports FastCGI, such as Lighttpd or Hiawatha. Another deployment option is nginx and uwsgi. It should also be possible to use other WSGI-compliant web servers. Django officially supports four database backends: PostgreSQL, MySQL, SQLite, and Oracle. MS SQL backend can be used with django-mssql but only in Microsoft operating systems, similarly external backends exist for IBM DB2, SQL Anywhere and Firebird. There is a fork named django-nonrel which supports NoSQL databases like MongoDB and Google App Engine's Datastore.

Django may also be run in conjunction with Jython on any Java EE application server such as GlassFish or JBoss. In this case django-jython must be installed in order to provide JDBC drivers for database connectivity, which also provides functionality to compile Django in to a .war suitable for deployment.

Versions of Django prior to 1.0 had multithreading issues.[12] Users running such a version should use it in a single-threaded server configuration, such as with Apache prefork MPM using mod_python, or the embedded mode of mod_wsgi. Although Django 1.0 is principally believed to now be thread safe, some minor threading issues are still occasionally being found; it may be prudent to continue to use a single-threaded server configuration and/or stay current with Django releases and notices about the multithreading issues.[12]

Google App Engine includes support for Django version 1.x.x[13] as one of the bundled frameworks.

Integrated development environments

While a number of Django developers use text editors such as Vim, Emacs or TextMate with Django Bundle for their projects, others prefer more specialized tools providing debugging, refactoring, unit testing, etc.[14]

DjangoCon

There is a twice-yearly conference for Django developers and users, named "DjangoCon", that has been held since September 2008. One DjangoCon a year is held in Europe, in May or June;[16] while the other is held in the United States in September, usually in Portland, Oregon.[17]

Books

  • The Definitive Guide to Django (Apress) - first edition December 2007, second edition July 2009. Released under the GNU Free Documentation License.[18] Available online for free at www.djangobook.com.
  • Practical Django Projects by James Bennett (Apress) - first edition June 2008, second edition June 2009.[19]
  • Pro Django by Marty Alchin (Apress) - December 2008.[20]
  • Jeff Forcier; Wesley Chun; Paul Bissex (2009). Python Web Development with Django. Addison-Wesley. ISBN 978-0-13-235613-8.[21]

See also

References

Bibliography