Django implementation of annotatorjs Storage.
Implements most of the methods as per the
Core Storage/Search API
documentation (root
, index
, create
, read
, update
,delete
and
search
).
To see a working demo:
sh poetry install poetry run python3 ./demo.py
This will run the tests, after which a demo. page will be available at /demo
.
The package can be installed via poetry
:
poetry add django-annotator
Following installation it can be added to any Django project by updating the
INSTALLED_APPS
, along with its dependencies:
INSTALLED_APPS = (
...
"rest_framework",
"django_filters",
"annotator",
)
As per the integration
documentation
for django-filter
, DEFAULT_FILTER_BACKENDS
must also be added to
settings.py
:
REST_FRAMEWORK = {
"DEFAULT_FILTER_BACKENDS": (
"django_filters.rest_framework.DjangoFilterBackend",
),
},
Then run migrate
to include the new tables from django-annotator
:
poetry run python3 ./manage.py migrate
The package relies on Annotator being installed in your project—see the documentation for details of its inclusion.
As per Annotator's documentation, the root endpoint will return information in the format:
{
"name": "django-annotator-store",
"version": "2.1.0"
}
The name
returned can be configured by setting ANNOTATOR_NAME
in your
settings
(defaulting to the above).
If you have any issues with Cross-origin resource sharing (CORS), consider
installing
django-cors-headers
.