
在项目setting下的DATABASES下配置自己的数据库连接如下图
生成数据库,点击Tools 选择Run manage.py Task
如果报错为:No module named MySQLdb
需要在虚拟环境中安装mysql驱动(pip install mysql-python)
如果在windows环境下安装失败请到https://www.lfd.uci.edu/~gohlke/pythonlibs/下找到MySQL-Python下载
然后在进入虚拟环境中

安装完毕 点击Tools 选择Run manage.py Task 输入migrate生成django所需的数据表,证明已经连接成功
网友评论