This package lets you easily integrate the Algolia Search API to your Django project. It’s based on the algoliasearch-client-python package.

You might be interested in this sample Django application providing a typeahead.js based auto-completion and Google-like instant search: algoliasearch-django-example

Compatible with Python 2.7, Python 3.4+ and Django 1.7+


pip install algoliasearch-django


In your Django settings, add algoliasearch_django to INSTALLED_APPS and add these two settings:

    'API_KEY': 'MyApiKey'

There are several optional settings:

  • INDEX_PREFIX: prefix all indices. Use it to separate different applications, like site1_Products and site2_Products.
  • INDEX_SUFFIX: suffix all indices. Use it to differentiate development and production environments, like Location_dev and Location_prod.
  • AUTO_INDEXING: automatically synchronize the models with Algolia (default to True).
  • RAISE_EXCEPTIONS: raise exceptions on network errors instead of logging them (default to settings.DEBUG).

Quick Start

Create an inside each application that contains the models you want to index. Inside this file, call algoliasearch.register() for each of the models you want to index:


import algoliasearch_django as algoliasearch

from .models import YourModel


By default, all the fields of your model will be used. You can configure the index by creating a subclass of AlgoliaIndex and using the register decorator:


from algoliasearch_django import AlgoliaIndex
from algoliasearch_django.decorators import register

from .models import YourModel

class YourModelIndex(AlgoliaIndex):
    fields = ('name', 'date')
    geo_field = 'location'
    settings = {'searchableAttributes': ['name']}
    index_name = 'my_index'