Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Thananjaya Chakravarthy
Thananjaya Chakravarthy
4,672 Points

In django,there are many topics such as app, models, views,urls. I cant figure how the flows must be carried on?

Whats the purpose of app,models,views,urls. In what steps one have to move on with django.?

1 Answer

Travis Bailey
Travis Bailey
13,675 Points

You're entering the world of MVC (Model, View, Controller). It's a pretty daunting concept to grasp, but once it clicks it'll make sense.

MVC is a way of breaking apart the logic for a web application. According to this article The model contains the underlying logic behind the web app. So the under the hood parts that the user doesn't see. The view, which provides the 'template' that builds the page. Last is the controller which ties the view and controller together. Django has a slightly different take that they call out in a part of their FAQ that's a little tricky to find. However, it all comes back to the same concept of separating the logic with the user interface (template) and having something to tie them together.

My favorite example of this is YouTube. With many thousands of videos getting uploaded every minute, there's no way someone could manually create a new web page for each video. So there's a template web page for each video on YouTube (view), there's also underlying logic to make sure the right video, comments, and statics are recorded and provided for each video (model), and there's the controller that facilitate the movement of this data to the view, and facilitate interactions in the view to the model (say when someone clicks the like button on a video).