Django之ORM操作(***)
生成数据库:
python manage.py makemigrations
python manage.py migrate
常用命令:
python manage.py runserver 0.0.0.0
python manage.py startapp appname
python manage.py syncdb
创建superuser:python manage.py createsuperuser
在项目名中的__init__ .py 加:
import pymysql
pymysql.install_as_MySQLdb()
配置数据库:
DATABASES = { ‘default‘: { ‘ENGINE‘: ‘django.db.backends.sqlite3‘, ‘NAME‘: os.path.join(BASE_DIR, ‘db.sqlite3‘), ‘USER‘:"xxxxx", ‘PASSWORD‘:"xxxxxxx", ‘HOST‘:"xxxxxxx", ‘PORT‘:"3306" } }
原文地址:https://www.cnblogs.com/george92/p/8505452.html
时间: 2024-10-10 20:20:17