Issue
I have followed several django tutorials. I do not know why controllers are stored in a file called views.py
and confused by this filename.
I am looking for a MVC development. Are there other files in django for "real" controllers ?
Solution
Yes ! Actually it's a design decision and It's described by the guys behind Django Here.
Basically their argument is that, in their opinion,
In our interpretation of MVC, the “view” describes the data that gets presented to the user. It’s not necessarily how the data looks, but which data is presented. The view describes which data you see, not how you see it. It’s a subtle distinction.
a “view” is the Python callback function for a particular URL, because that callback function describes which data is presented.
I entice you to read the entry to get a hold of the overal idea behind the views naming.
About the controllers, Yes again. Mostly though, you can define several layers of the so called Middlewares in django to handle lots of your static logic before/after requests are handled by views, but still, it's the view that plays the main role of a controller in Django.
Answered By - SpiXel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.