Skip to content

Instantly share code, notes, and snippets.

@tsabat
Forked from defulmere/settings.py
Created February 7, 2021 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsabat/e5f085409903bee9bca556e90e1f20ad to your computer and use it in GitHub Desktop.
Save tsabat/e5f085409903bee9bca556e90e1f20ad to your computer and use it in GitHub Desktop.
How to override an old sqlite3 module with pysqlite3 in django settings.py
# 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'),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment