1.
Build a project
2.
Create first page
3.
Create an App
4.
Then add a page to the app
4.1
Inside the setting Configuration:
Add in My_project URL
Add in App1 's URLs
Create views
And then
You can access it through 127.0.0.1:8000.
5.
Configuration database
Modifying database information in setting
Check to see if the database is connected
In my workbench, I can see that the default table is generated
Next we build our own model (we need to inherit models. Model)
Run command
And then run
You can see that the table is created
Next work on the database
I'm going to insert 2 data into MySQL.
View discovery data has been successfully inserted
Then we
Modify the model to return the name and modify the views to display the returned results on the page
Results can be seen after running
That's the whole process, basically.
Python Learning--django--Connection database MySQL Create model