3. Running Django encounters django.db.utils.OperationalError

Problem: database connection problem

Insert picture description here
Insert picture description here

Solution:

1. Check whether the database is connected correctly

2. Check whether the field name corresponds to

3. Check whether the entity class field corresponds to the database field

4. Enter and execute the following 2 statements in the terminal

python manage.py makemigrations
python manage.py migrate

5. Restart the server

Don't think that the fields you have set are correct. Look carefully and find out. For example, there is an error such as an underscore in the field setting, which does not correspond to the Django model class. In short, be careful.

Guess you like

Origin blog.csdn.net/Erudite_x/article/details/112911243