pip install mysql-python
create databases test2 charset=utf8
DATABASES = {
‘default‘: {
‘ENGINE‘: ‘django.db.backends.mysql‘,
‘NAME‘: ‘test2‘,
‘USER‘: ‘用户名‘,
‘PASSWORD‘: ‘密码‘,
‘HOST‘: ‘数据库服务器ip,本地可以使用localhost‘,
‘PORT‘: ‘端口,默认为3306‘,
}
}
python manage.py inspectdb > booktest/models.py
原文:https://www.cnblogs.com/joshuazc/p/9533249.html