Reason for error:
The MySQLdb package has been deprecated in python3.
The solution
install pymysql package
pip install PyMySQL
To take the following directory structure as an example, add the following code to test5/test5/init.py:
import pymysql
pymysql.install_as_MySQLdb()
∎── booktest
∎ ∎── admin.py
∎ ∎── apps.py
∎ ── init.py
∎ ∎── migrations
∎ ∎ ∎── init.py
∎ ∎ └── pycache
∎ ∎── models.py
∎ ∎── pycache
∎ ∎── tests.py
∎ ∎── urls.py
∎ └── views.py
°── manage.py
°── static
∎ └── booktest
∎ └── a1.jpg -> /usr/share/wallpapers/deepin/Flying_Whale_by_Shu_Le.jpg
── templates
∎ └── index.html
└── test5
── init.py
── pycache
── settings.py
──urls.py
└── wsgi.py