django2.1新手教程
数据库同步操作
自动生成sql语句
django会根据setting.py中指定的数据库自动生成sql语句:python manage.py makemigrations
查看自动生成的sql语句python manage.py sqlmigrate 【appname】 【no】
例:python manage.py sqlmigrate myblog 0001
自动同步到数据库python manage.py migrate
bug: MySQL Strict ModeWARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended y
ou activate it. See: https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-sql-mode
解决方法1
在settings中,在DATABASES变量定义处下面添加DATABASES['OPTIONS&#