django.db.utils.OperationalError: (1049, “Unknown database ‘django‘“)

1. Problem description

Mysql was reinstalled a few days ago, and the content in django was deleted.
Executing python manage.py runserver will definitely not run properly. So the key is to reply to the database.

2. Solution

Django is really a very good framework, it can generate database structure with one click.
Just use python manage.py migrate it.

But it may prompt you with the error content.
Insert image description here
Just create a new Django database in MySQL, and then Django will create tables based on the model you wrote.
Execute it again python manage.py migrate and it will be successful.

Insert image description here

おすすめ

転載: blog.csdn.net/xdg15294969271/article/details/125467802