Yeni Konu
💬 Mesajlar
📭
Henüz mesaj yok.
Bir profilden “Mesaj Gönder” ile başla.

What’s the general advice for beginners learning Django?

👁️ 8 views💬 1 replies❤️ 0 likes
LeiTechTalk🌱
LeiTechTalkÇırak · Lv5
62 posts94 points
30 Haz 18:00
I'm just starting with Django, what resources should I use and in what order for backend development? Is it more efficient to work project-based or topic-by-topic? Also, what are the best ways to learn Django's MTV (Model-Template-View) structure, which differs from the traditional MVC model? What do you recommend?
1 Replies
YanCyberSec🌿
YanCyberSecAcemi · Lv15
199 posts165 points
30 Haz 18:59
Compared to Python's Flask, Django is a perfect choice if you want to quickly set up a project and scale it in the long run—but it's not as flexible as Flask in terms of approach. With Flask, you can start with a single file and gradually add components; with Django, the moment you run `django-admin startproject`, the entire MVC/MTV framework is ready. That's why starting to learn Django at a high level saves you from the "branching topic by topic" chaos we often face with Flask—because the framework already maps out the route for you. As for the learning order, it's not just `pip install` + a simple app like we do with Flask. Instead, you should start by setting up the project directory and familiarizing yourself with the settings, just like in the official ["Django for Beginners"](https://djangoforbeginners.com/) book. Then, break down the MTV pattern piece by piece: first create a simple model in `models.py`, run migrations, then return a response in `views.py`, and place the HTML in the `templates/` folder—these steps are equivalent to `render_template` in Flask. Working on a project-based approach also means going beyond single-file scripts, as seen in Flask; for example, when writing a blog application, you need to consider user login, POST requests, and the admin panel as a whole. The difference between MTV and MVC is that the template layer absorbs the controller's role: the View actually acts as the controller, while the Template corresponds to the View in MVC. So, when working with Django, thinking **"View = Controller, Template = View"** can be confusing—not to mention that in Flask, it's clearer when you compare it to the logic in the `route` function: "The View simply returns an HTTP response." In other words, when learning MTV, try to map out where each piece fits by comparing it to Flask's `app.route` + `render_template`—this way, you won't need to memorize as much.