| No. | title | |
|---|---|---|
| 1 | To myself as a Django beginner (1)-Project app- | |
| 2 | To myself as a Django beginner (2)-What is MTV- | ☆ |
| 3 | To myself as a Django beginner (3)-Hello world!- | |
| 4 | To myself as a Django beginner (4)-Memo app creation- |
Last time is ready. Let's write the code this time! Before, let's take a quick look at how Django works.
In the first place, * Django consists of three main roles, Model --Template --View, and these acronyms are called MTV model or MTV framework. *
--Model: Describes the definition of the data to be stored in the database and retrieves the data from the database. (Models.py)
--Template: The design of the page designed by the template file (HTML). (Templates)
--View: Gets data from the database on request and decides how to display it on the screen. (Views.py)
......??
It's hard to imagine even if you read this much. What to hide A month ago I had a lot of trouble understanding this. A simple diagram is shown below, so let's look at it together.

Let's look at the figure.
https://www.japanese-django.com/about. (Http request)models.py from the database. Put those data on the appropriate ** Template (about.html) ** and display it on the screen. (response)After going through these steps, you were finally able to see the contents of https://www.japanese-django.com/about. It's okay if you haven't come to a pin yet. Suddenly, on the day when I was actually writing the code, I suddenly said, "Ahhhhhhhhhhhhhhhhhhh!
Django uses the ** MTV model **.
--Model: Definition of data to be stored in the database and acquisition of data. (Models.py)
--Template: Page design with template file (HTML). (Templates)
--View: Processing according to the request (how to display on the screen). (Views.py)
Next time will be doing "Hello World!" With Django!
Recommended Posts