CentOS comes with 3.7.17 Django, which is not supported. It must be above 3.9.0. If you want to use SQLite3 as a database, there is no way to upgrade it. If it is me, I will not use SQLite3, but use mysql
The upgrade is simple:
1. Download the latest package of SQLite3
https://www.sqlite.org/download.html
wget https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz
2. Compile and install
tar xf https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz
cd sqlite-autoconf-3350500
./configure --prefix=/usr/local/ && make && make install
3. Change the original SQLite3 command
First check which directory SQLite3 has executable files in
(python36) [root@george servermonitor]# whereis sqlite3
sqlite3: /usr/bin/sqlite3 /usr/local/bin/sqlite3 /usr/include/sqlite3.h /usr/share/man/man1/sqlite3.1.gz (python36) [root@george servermonitor]#
It is found that/usr/bin/SQLite3 is old, 3.7.17. If you are not sure, just execute it
/usr/bin/sqlite3 –verssion
Then replace the old version
mv /usr/bin/sqlite3 /usr/bin/sqlite3_3.7.17
ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
4. Change the library path
Many small partners went to the above and tested it. They found that the same error was still reported when executing Python manage.py runserver 8080. The reason is that Django read the old library, and you can verify it yourself
(python36) [root@george servermonitor]# python
Python 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623
(Red Hat 4.8.5-44)] on linux Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
> >>> sqlite3.sqlite_version
> '3.7.17'
>>> .exit
Modifying library variables
export LD_LIBRARY_PATH="/usr/local/lib/"
Retest
(python36) [root@george servermonitor]# python Python 3.6.8
(default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
> >>> sqlite3.sqlite_version
'3.35.5'
>>> exit()
Execution returned to normal
(python36) [root@george servermonitor]# python manage.py runserver 8080
Django version 3.2.4, using settings 'servermonitor.settings' Starting development server at
http://127.0.0.1:8080/ Quit the server with CONTROL-C.
Read More:
- [Solved] Django Error: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
- [Solved] django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.Did you install mysqlclie
- [Solved] Python Project Error: django.core.exceptions.ImproperlyConfigured: WSGI application ‘WebTool.wsgi.application
- [Solved] DLL load failed while importing _sqlite3: the specified module could not be found.
- [Solved] from django.core.cache import cache Error
- [Solved] Django project locally Open Error: importerror: couldn’t import Django
- [Solved] Windows Configurate Python Environment error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft
- Python: Django exception when executing migrate operation: django.db.utils.OperationalError: (1051, “Unknown table’xxx’”)
- Django Issues: TypeError: “Settings” object is irreversible
- [Solved] Python Error: “RuntimeError: ‘cryptography‘ package is required for sha256_password or caching_sha2_pas”
- [Solved] Python Django error: error: (1146, “Table ‘mydb.django_session’ doesn’t exist”)
- Django Render home error: TypeError at /render() missing 1 required positional argument: ‘template_name‘
- [Solved] Python sqlite3.OperationalError: near “?“: syntax error
- [Solved] Django Configurate celery error: django.db.utils.DatabaseError
- [Solved] celery Startup Error: kombu.exceptions.VersionMismatch: Redis transport requires redis-py versions 3.2.0 or later. You have 2.10.6
- Django Error: ‘polls‘ is not a registered namespace
- Django PythonConsole error: Requested setting DEFAULT_INDEX_TABLESPACE
- Pychar: How to Fix using SQLite to report an error: java.lang.ClassNotFoundException
- [Solved] selenium.common.exceptions.JavascriptException: Message: javascript error: windows is not defined
- Python environment error, bad interpreter: there is no file or directory