1 django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is...
查看报错信息,找到出错的文件---错误信息里面会告诉你错误文件

将文件中的如下代码注释
if version < (1, 3, 3):
raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)
2 django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'
用了mysql数据库需要在init.py里面添加
import pymysql
pymysql.install_as_MySQLdb()
3 django.db.utils.OperationalError: (1044, "Access denied for user 'root'@'172.16.62.1' to database 'dailyfresh'")
这是mysql的权限问题
我们链接了mysql数据库

我们要给这个用户添加权限
先链接数据库
grant all on dailyfresh.* to 'root'@'172.16.62.1' identified by 'root_psd' with grant option;
flush privileges;
数据库名、用户名、用户密码、ip按自己的填写(一定不能填错了)
4 django.db.utils.InternalError: (1060, "Duplicate column name 'addr_id'")
执行 python manage.py migrate生成表是的问题,这说明表已经生成过了,不用重新生成
可以直接运行程序了,你也可以把表删除重新生成,如果不删除直接运行会有
You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
这个提示,不用管它
5 TemplateDoesNotExist at /

文件找不到,看是不是没上传
6 celery -A tasks worker --loglevel=info 报错

是因为celery用到了django项目的项目,需要引入Django的配置
# 在任务处理者一端加这几句
# import os
# import django
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dailyfresh.settings")
# django.setup()
7 No installed app with label 'admin'
我遇到这个问题是因为下载了一个包出现的这个问题
pip install django-redis
image.png
执行这个类似的指令就更新了我的Django,我的是Django==1.82,更新到2.2
然后我卸载这两个包,重新安装指定版本的包

网友评论