Models are the database tables represented in Django as Python classes.Views are the HTML returned from function in views.py.Controllers are the actual functions themselves in views.py invoked from a HTTP request.

However I read on Wikipedia (at the time of writing):

... a regular-expression-based URL dispatcher ("Controller").

I would have thought the mapping of URLs to functions as routing - not the controller. But perhaps I am wrong - I guess I got my ideas because is ASP MVC the functions that handle the requests are contained in classes called Contollers...

1 Answer
1

Your thoughts are not wrong. In MVC web-frameworks, people often speak of a Base Controller that performs the routing of a request to the actual Controller that handles the request.

This has come about because web frameworks generally have a single point where the request is received by the application and in pure MVC terms, this is where the job of the Controller starts.

The Django framework uses a non-idiomatic way of naming the parts of the MVC triad.

The mapping between Django names and the idiomatic terminology is:

Idiomatic term | Django term | Meaning
Model | Model | Contains all the business logic. At the very least the database access logic
View | Template | Responsible for generating the HTML and other UI
Controller | View | Contains the logic to tie the other parts together and to generate a response to a user request