The Django Standard Library

Django’s standard library lives in the package django.contrib. Within each subpackage is a separate piece of add-on functionality. These pieces are not necessarily related, but some django.contrib subpackages may require other ones.

There’s no hard requirement for the types of functionality in django.contrib. Some of the packages include models (and hence require you to install their database tables into your database), but others consist solely of middleware or template tags. The single characteristic the django.contrib packages have in common is this: if you were to remove the django.contrib package entirely, you could still use Django’s fundamental features with no problems. When the Django developers add new functionality to the framework, they use this rule of thumb in deciding whether the new functionality should live in django.contrib or elsewhere. django.contrib consists of these packages:

  • admin: The automatic admin site.
  • auth: Django’s authentication framework.
  • comments: A comments application. This application is currently under heavy development and thus couldn’t be covered fully in time for this book’s publication. Check the Django Web site for the latest information about the comments application.
  • contenttypes: A framework for hooking into “types” of content, where each installed Django model is a separate content type. This framework is used internally by other “contrib” applications and is mostly intended for very advanced Django developers. Those developers should find out more about this application by reading the source code in django/contrib/contenttypes/.
  • csrf: Protection against Cross-Site Request Forgery (CSRF).
  • flatpages: A framework for managing simple “flat” HTML content in a database. See the later section titled “Flatpages.”
  • humanize: A set of Django template filters useful for adding a “human touch” to data. See the later section titled “Humanizing Data.”
  • markup: A set of Django template filters that implement a number of common markup languages.
  • redirects: A framework for managing redirects. See the later section titled “Redirects.”
  • sessions: Django’s session framework.
  • sitemaps: A framework for generating sitemap XML files.
  • sites: A framework that lets you operate multiple Web sites from the same database and Django installation.
  • syndication: A framework for generating syndication feeds in RSS and Atom.

The rest of this chapter goes into detail about each django.contrib package that we haven’t yet covered in this book.

Back to Tutorial

Share this post
[social_warfare]
Other Contributed Subframeworks
Sites

Get industry recognized certification – Contact us

keyboard_arrow_up