实证未遂。
【MySQL-python】
参考:https://stackoverflow.com/questions/23376103/python-3-4-0-with-mysql-database
pip install MySQL-python
参考:https://www.jianshu.com/p/7703f5fd4cc0
【mysqlclient】
For acess MySQL from Python, install:
pip install mysqlclient
【PyMySQL】
参考:https://imshusheng.com/python/216.html
官网:https://github.com/PyMySQL/PyMySQL
官网:https://pypi.org/project/pymysql/
pip install PyMySQL
Django整合:
找到first/first/__init__.py,在里面输入以下内容并保存:
import pymysql pymysql.install_as_MySQLdb()
再运行
python manage.py runserver
又爆了一个提示:
You have unapplied migrations; your app may not work properly until they are applied. Run 'python manage.py migrate' to apply them.
当然这个提示并不影响自带服务器的运行,这时候我们访问http://127.0.0.1:8000,会看到成功提示:
It worked!