具体错误提示是:django.db.utils.NotSupportedError: DISTINCT ON fields is not supported by this database backend 刚好遇到mysql数据库查重,使用distinct方法来做去重查询,结果遇到这个错误.先看一下distinct的源码: def distinct(self, *field_names): """ Return a new QuerySet instance that wi…
django startproject xxx:报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 13: ordinal not in range(128) 原因:文件夹最好不要出现中文…
Django迁移数据库报错 table "xxx" already exists错误 django在migrate时报错django migrate error: table 'xxx' already exists错误. 解决方案python manage.py migrate --fake <appname>…
django正常运行却报错的处理方法 出处 : https://www.infvie.com/ops-notes/django-normal-operation-error 报错一:self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接. 解决方法:找到python/Lib/socketserver.py文件,修改SocketWriter类的write方法,具体如下: def write…
AS报错:lambda expressions are not supported at this language level 解决方法 打开打开 File --> Project Stucture 选择Modules(汉化版对应为:文件-->项目结构)如图所示 选择对应的项目,比如图片当中的app项目,在默认情况下Source Compatibility和Target Compatibility都为空.然后按如下步骤修改: 1)      Source Compatibility选择1.8…
以前在mysql5.7上执行如下sql语句没有问题 SELECT DISTINCT u.*,c.content userCategory FROM m_user u LEFT JOIN m_category c ON u.user_category=c.category_id LEFT JOIN m_user_role mr ON u.user_id=mr.user_id WHERE 1=1 AND u.user_status=0 ORDER BY u.createtime DESC LIMIT…
django跨域使用 pip install django-cors-headers 然后在settings文件中加上参数设置 # app配置 INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles…
完整报错信息如下 django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing se…
原因: 问题1. 即从mysql5.7版本之后,默认采用了caching_sha2_password验证方式. 问题2.  然后在执行 python manage.py makemigrations依然报错,如下图2/3   raise errorclass(errno, errval)   django.db.utils.OperationalError: (1045, u"Access denied for user 'root'@'localhost' (using password: Y…
在django下创建APP项目时遇到的坑 python manage.py startapp app01 报错内容如下: 解决:找到报错中的文件夹151行删除items(),)中的逗号即可 在命令行下运行python manage.py runserver/python manage.py createsuperuser时提示错误:ImportError: Couldn't import Django. Are you sure it's installed and available on y…