SoFunction
Updated on 2024-11-19

Django's development steps turned out to be like this

Django is an open source web application framework written in Python.

The development steps are as follows.

1. Installing Django

pip install django

2. Creating a django project

django-admin startproject mysite

You can also use pycharm to create it. If you use pycharm to create it, remember to delete the DIRS templates in it.

在这里插入图片描述

3. Create and register the app

python  startapp app01

在这里插入图片描述

If you don't perform step 3, you can't create a table in the database when you write a class under the app.

4. Configure static file paths and template paths

5. Configuring database-related operations

(1) Installation of third-party libraries

pip install mysqlclient

(2) Go to MySQL to create a database

(3) Configure the files in the database.

在这里插入图片描述

(4) Write the code to create the table in the app under the

在这里插入图片描述

(5) Execute the two commands, you can create the corresponding table in the database through the class in.

python  makemigrationspython  migrate

6. Relationship between in, route, create url and view functions

在这里插入图片描述

7. In the, view function, write the business logic

在这里插入图片描述

8. In the templates directory, write the HTML template

在这里插入图片描述

summarize

That's all for this post, I hope it was helpful and I hope you'll check back for more from me!