Last active
December 16, 2024 17:20
-
-
Save defulmere/8b9695e415a44271061cc8e272f3c300 to your computer and use it in GitHub Desktop.
How to override an old sqlite3 module with pysqlite3 in django settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ⚠️ USE AT YOUR OWN RISK | |
# first: pip install pysqlite3-binary | |
# then in settings.py: | |
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package | |
__import__('pysqlite3') | |
import sys | |
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3') | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3', | |
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
} | |
} |
thanks, worked for me.
import('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
Worked perfectly for me too.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seemed to work for me:
Download the Latest SQLite Source:
wget https://www.sqlite.org/2023/sqlite-autoconf-3430100.tar.gz
Extract the Downloaded File:
tar -xvf sqlite-autoconf-3430100.tar.gz
cd sqlite-autoconf-3430100
Build and Install SQLite:
./configure
make
sudo make install
Verify the Installation:
After installation, confirm that the new version is available:
sqlite3 --version
Verify in Python:
Ensure that Python picks up the updated SQLite version:
python -c "import sqlite3; print(sqlite3.sqlite_version)"