I have created a Django project with the new JSONField announced in Django 3.1, which supports all databases.
I have successfully used this field on a linux machine, but running python manage.py migrate with the same project on Windows fails with the following message:
(fields.E180) SQLite does not support JSONFields.
The same versions of Python and Django are used in both PCs.
I have created a Django project with the new JSONField announced in Django 3.1, which supports all databases. I have successfully used this field on a linux machine, but running python manage.py migrate with the same project on Windows fails with the following message: (fields.E180) SQLite does not support JSONFields.
Applying migrations on an installation using spatialite backend (probably sqlite too) where the path to the database file does not exist causes a confusing JSON field error. Take this following DATABASES configuration. Note that the dev.sqlite3 file does not exist. When running ./manage.py migrate the following exception is raised
Extract sqlite3.dll from the downloaded DLL archive and put it in the DLLs directory. Now, the JSON1 extension should be ready to be used in Python and Django. Thanks for contributing an answer to Stack Overflow!
For using JSONField with Django 3.1+ and sqlite, the JSON1 sqlite extension must be installed.
To enable JSON1 on sqlite follow the instructions on Django's wiki: https://code.djangoproject.com/wiki/JSON1Extension.
Instructions for Windows:
python -c "import platform;print(platform.architecture()[0])"
%localappdata%\Programs\Python\PythonXX, where XX is the Python version. For example, it's located in C:\Users\<username>\AppData\Local\Programs\Python\Python37. If you added Python installation directory to your PATH environment variable, you can run the command where python on a command prompt to locate it.
Enter the DLLs directory in your Python installation.sqlite3.dll inside the DLLs directory.sqlite3.dll from the downloaded DLL archive and put it in the DLLs directory.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With