一、设置时间和时区
在工程包lianxi(settings.py) 更改数据
更改地点
LANGUAGE_CODE = 'zh-Hans',
TIME_ZONE = 'Asia/Shanghai'
二、Django No changes detected 本地无法生成迁移文件
settings.py 没有注册app
三、报错信息
TypeError: __init__() missing 1 required positional argument: 'on_delete'
原因:
正确:
四、报错信息 TypeError: module.__init__() takes at most 2 arguments (3 given)
继承错了,models.Model
五、报错信息:django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
解决方法:把下面2行代码注释掉
六、报错信息
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
安装pyMySQL
pip install pyMySQL
在项目文件下 __init__.py文件下
import pymysql
pymysql.install_as_MySQLdb()
七、报错信息:
RuntimeError: You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8000/upload.html/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
把form action 后面加个斜杠