Changes between Version 1 and Version 2 of JSON1Extension


Ignore:
Timestamp:
May 10, 2020, 5:46:37 AM (4 years ago)
Author:
Sage Abdullah
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • JSON1Extension

    v1 v2  
    55==================================
    66
    7 To use **django.db.models.JSONField** on SQLite, you need to enable the `JSON1 extension`__ on Python's `sqlite3`__ library. If the extension is not enabled on your installation, a system error (`fields.E180`) will be raised. To check if the extension is enabled on your installation, you can do a query with one of the functions included in the extension, e.g. `JSON()`. For example::
     7To use **django.db.models.JSONField** on SQLite, you need to enable the `JSON1 extension`__ on Python's `sqlite3`__ library. If the extension is not enabled on your installation, a system error (``fields.E180``) will be raised. To check if the extension is enabled on your installation, you can do a query with one of the functions included in the extension, e.g. ``JSON()``. For example::
    88
    99    >>> import sqlite3
     
    2424- Download the `SQLite amalgamation`__, with or without the configuration script.
    2525- Extract the source code archive and enter the directory of the result.
    26 - Compile the source code using the `-DSQLITE_ENABLE_JSON1` flag to enable the JSON1 extension. For example::
     26- Compile the source code using the ``-DSQLITE_ENABLE_JSON1`` flag to enable the JSON1 extension. For example::
    2727
    2828    gcc -DSQLITE_ENABLE_JSON1 -c -fPIC sqlite3.c
     
    3333    gcc -shared -o libsqlite3.so -fPIC sqlite3.o -ldl -lpthread
    3434
    35 - Place the resulting file (`libsqlite3.so`) in a desired directory, e.g. `/usr/lib/sqlite3/`.
    36 - Set the `LD_PRELOAD` environment variable to use your compiled SQLite every time you run Django. For example::
     35- Place the resulting file (``libsqlite3.so``) in a desired directory, e.g. ``/usr/lib/sqlite3/``.
     36- Set the ``LD_PRELOAD`` environment variable to use your compiled SQLite every time you run Django. For example::
    3737
    3838    export LD_PRELOAD=/usr/lib/sqlite3/libsqlite3.so
     
    4646=====
    4747
    48 On macOS, follow the instructions for Linux above, but instead of setting the `LD_PRELOAD` environment variable, use `DYLD_LIBRARY_PATH`. For example::
     48On macOS, follow the instructions for Linux above, but instead of setting the ``LD_PRELOAD`` environment variable, use ``DYLD_LIBRARY_PATH``. For example::
    4949
    5050    export DYLD_LIBRARY_PATH=/usr/lib/sqlite3
     
    5454
    5555- Download the `precompiled DLL`__ that matches your Python installation (32-bit or 64-bit).
    56 - Locate your Python installation. By default, it should be in `%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.
    57 - Enter the `DLLs` directory in your Python installation.
    58 - Rename (or delete) `sqlite3.dll` inside the `DLLs` directory.
    59 - Extract `sqlite3.dll` from the downloaded DLL archive and put it in the `DLLs` directory.
     56- Locate your Python installation. By default, it should be in ``%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.
     57- Enter the ``DLLs`` directory in your Python installation.
     58- Rename (or delete) ``sqlite3.dll`` inside the ``DLLs`` directory.
     59- Extract ``sqlite3.dll`` from the downloaded DLL archive and put it in the ``DLLs`` directory.
    6060- Now, the JSON1 extension should be ready to be used in Python and Django.
    6161
Back to Top