17👍
If you don’t want to recompile Python and you’re using a virtualenv you can do this to set it up without affecting the system as a whole (I’ve done this with Ubuntu 16/18):
-
Download SQLite tarball from https://www.sqlite.org/download.html
-
Extract the contents and cd into the folder.
-
Run the following commands:
./configure
sudo make install
-
Now edit the
activate
script used to start your virtualenv so Python looks in the right place for the newly installed SQLite. Add the following line to the top of/path/to/virtualenv/bin/activate
:export LD_LIBRARY_PATH="/usr/local/lib"
Now, when active, Django 2.2+ should work fine in the virtualenv. Hope that helps.
10👍
This error comes because your virtual environment could not connect to newly updated sqlite3 database. For that you have to update your sqlite3 database version manually and then give path of it to your virtual environment. Kindly follow below steps:
-
Download latest sqlite3 from official site. (https://www.sqlite.org/download.html)
wget http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz
-
Then go to that folder and fire command.
tar xvfz sqlite-autoconf-3070603.tar.gz
-
Go to respective folder.
cd sqlite-autoconf-3070603
-
./configure
-
make
-
make install
It may take too time but wait till end. If it’s take too much then terminate that process and continue rest of steps. -
Now you successfully install updated sqlite3. Now fire this command
sudo LD_RUN_PATH=/usr/local/lib ./configure --enable-optimizations
-
Open your activate file of virtual environment (e.g., venv/bin/activate) and add this line top of the file…
export LD_LIBRARY_PATH="/usr/local/lib"
-
Now for checking you can type this commands to your python shell
$ python
Python 3.7.3 (default, Apr 12 2019, 16:23:13)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.27.2'
- How can I automatically let syncdb add a column (no full migration needed)
- Active Django settings file from Celery worker
8👍
I’ve just been through this. I had to install a separate newer version of SQLite, from
https://www.sqlite.org/download.html
That is in /usr/local/bin. Then I had to recompile Python, telling it to look there:
sudo LD_RUN_PATH=/usr/local/lib ./configure --enable-optimizations
sudo LD_RUN_PATH=/usr/local/lib make altinstall
To check which version of SQLite Python is using:
$ python
Python 3.7.3 (default, Apr 12 2019, 16:23:13)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.27.2'
- Is exposing a session's CSRF-protection token safe?
- Django AttributeError 'tuple' object has no attribute 'regex'
- Disable caching for a view or url in django
- Django Generic Views: When to use ListView vs. DetailView
- Creating UTF-8 JsonResponse in Django
4👍
In addition to the above mentioned answers, just in case if you experience this behaviour on Travis CI, add dist: xenial
directive to fix it.
4👍
I have applied the following fix and it worked for my CentOS 7.x server.
Edit /usr/lib64/python3.6/site-packages/django/db/backends/sqlite3/base.py
file as per the below example:
def check_sqlite_version():
# if Database.sqlite_version_info < (3, 8, 3):
# 2018-07-07, edit
if Database.sqlite_version_info < (3, 6, 3):
raise ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version)
- {% load static %} and {% load staticfiles %}: which is preferred?
- Exclude field from values() or values_list()
- How to profile django channels?
- Django __call__() missing 1 required keyword-only argument: 'manager'
- Django querysets + memcached: best practices