文章目录
- 1. SQLite 3.8.3 or later is required (found 3.7.17)
- 2. ModuleNotFoundError: No module named '_sqlite3'
- 3. 导入的django项目不能至直接运行
- 4. 执行python3 manage.py makemigrations
- 5. Forbidden (CSRF cookie not set.)
- 6. pip安装模块出现连接问题
- 7. django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
- 8. 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.
- 9. ModuleNotFoundError: No module named 'MySQLdb'
- 10. 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
- 11. django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: xxx
- 12. django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.
- 13. django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.00
- 14. Requested setting USE_I18N, but settings are not configured.
- 15. ImportError: No module named 'MySQLdb'
- 16. OSError: mysql_config not found
- 17. ERROR: No matching distribution found for mysqlclient
- 18. ModuleNotFoundError: No module named 'import_export'
- 19. ModuleNotFoundError: No module named 'captcha.fields'
- 20. Django: ImportError: No module named 'corsheaders'
- 21. 使用PyCharm启动Django项目不能加载静态资源
- 22. ImportError: cannot import name 'six' from 'django.utils'
1. SQLite 3.8.3 or later is required (found 3.7.17)
raise ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version)django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).
① django版本降级
- 卸载当前的django版本:[root@instance-mtfsf05r mysite]# pip3 uninstall django
- 安装一个版本低一些的:[root@instance-mtfsf05r mysite]# pip3 install django==2.1.12
② 安装SQLite 3.8.3或以上的版本
【SQLite官网】:https://www.sqlite.org/download.html
-
下载SQLite3源码安装包:[root@instance-mtfsf05r ~]# wget https://www.sqlite.org/2019/sqlite-autoconf-3290000.tar.gz
-
解压缩:[root@instance-mtfsf05r ~]# tar -zxvf sqlite-autoconf-3290000.tar.gz
-
切换到sqlite目录下:[root@instance-mtfsf05r ~]# cd sqlite-autoconf-3290000/
-
释放编译文件:[root@instance-mtfsf05r sqlite-autoconf-3290000]# ./configure --prefix=/usr/local/sqlit329
-
编译和安装[root@instance-mtfsf05r sqlite-autoconf-3290000]# make && make install
-
查看当前全局sqlite3的版本检查sqlite3版本还是没有被改变,所以更改旧的sqlite3:
[root@instance-mtfsf05r ~]# sqlite3 -version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
[root@instance-mtfsf05r ~]# mv /usr/bin/sqlite3 /usr/bin/sqlite3_old
-
为新版本创建软链接:[root@instance-mtfsf05r ~]# ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
-
检查当前SQLite3版本:[root@instance-mtfsf05r ~]# sqlite3 --version
-
检查Python的SQLite3版本:[root@instance-mtfsf05r ~]# python3
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.29.0'
再次运行django项目:
2. ModuleNotFoundError: No module named ‘_sqlite3’
错误场景:运行Django项目的时候报错,找不到_sqlite3模块
问题原因:因为安装python3的时候没有找到安装sqlite3依赖
解决方式:安装这个模块,然后编译安装python3
[root@instance-mtfsf05r Python-3.7.3]# yum install sqlite*
[root@instance-mtfsf05r Python-3.7.3]# make && make install
ps:在重新编译安装python的时候,需要安装一些依赖,下面是安装python的依赖:
[root@VM_39_157_centos ~]# yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
3. 导入的django项目不能至直接运行
解决方式:
1、第一步
2、第二步
4. 执行python3 manage.py makemigrations
执行python3 manage.py makemigrations报下面的错误:
You are trying to add a non-nullable field 'goods' to order without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
2) Quit, and let me add a default in models.py
Select an option:
执行python3 manage.py migrate报下面的错误:
Operations to perform:
Apply all migrations: admin, app, auth, contenttypes, sessions
Running migrations:
No migrations to apply.
Your models have changes that are