Django’s MVC framework

Django is a Model–view–controller (MVC) framework, or software architecture. This type of architectural pattern isolates domain logic (the application logic for the user), user interface (input and presentation), and testing and maintenance of each (separation of concerns).

Standard MVC frameworks

Typically, an MVC framework looks like this:

  • Model: Database and business logic (domain logic).
  • View: The view manages the display of information, or look and feel.
  • Controller: The controller interprets the mouse and keyboard inputs from the user, and maps one to the other.

Django’s MVC framework

Django is more of a Model-Template-View framework due to its templating feature, where:

  • Model: Database and business logic (domain logic).
  • Template:  The separation of content from presentation.
  • View: In Django, the view describes which data is presented, not how you see it. In typical MVC frameworks, the view delegates to a template, which describes how the data is presented. According to Django’s FAQ page, …a “view” is the Python callback function for a particular URL, because that callback function describes which data is presented.

Django’s controller is the framework itself: the machinery that sends a request to the appropriate view, according to the Django URL configuration.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s