[Answered ]-Problem with SQLite when deploying Django Website on AWS, cant properly install pysqlite

1👍

The error here appears to stem from the lack of the development headers for sqlite compilation in the AWS environment.

In your ubuntu environment, the development headers likely already exist, and you can confirm that they do with something like:

$ dpkg -l | grep sqlite
ii  libsqlite3-0:amd64                 3.31.1-4ubuntu0.3                 amd64        SQLite 3 shared library
ii  libsqlite3-dev:amd64               3.31.1-4ubuntu0.3                 amd64        SQLite 3 development files

Since the author of pysqlite3 has provided both the source distribution and a precompiled binary version, you should only add one to the requirements file you intend to ship to Elastic Beanstalk – pysqlite-binary (https://pypi.org/project/pysqlite-binary/)

Then you should be able to use it via import pysqlite3

0👍

As mike said:

I add to requirements.tht just:

pysqlite3-binary==0.5.0

I also added in settings.py:

__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')

before:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}
👤korky

Leave a comment