【Django】django.core.exceptions.ImproperlyConfigured: mysqlclient 1.4.0 or newer is required

 

 

在setting.py的__init__.py里

 

问题:

django.core.exceptions.ImproperlyConfigured: mysqlclient 1.4.0 or newer is required

解决方案:

import pymysql
pymysql.version_info = (1, 4, 13, "final", 0)
pymysql.install_as_MySQLdb()  # 使用pymysql代替mysqldb连接数据库


问题:

WARNINGS:
blog.Category: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the BlogConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.B
blog.Post: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
igAutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the BlogConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.B
igAutoField'.

解决方案:

settings.py 添加

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
 
问题:
django.db.utils.NotSupportedError: MySQL 8.0.11 or later is required (found 5.7.24).
 解决方案:
     注释~掉


posted @ 2020-11-07 19:29  Catonce  阅读(133)  评论(0)    收藏  举报