You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this page you will find our recommended way of installing Docker on your machine.
2
-
This guide is made for OSX users.
3
-
4
-
## Install Docker
5
-
6
-
First install Docker using [Homebrew](https://brew.sh/)
7
-
```
8
-
$ brew install docker
9
-
```
10
-
11
-
You can then install [Docker Desktop](https://docs.docker.com/get-docker/) if you wish, or use `docker-machine`. As we prefer the second option, we will only document this one.
12
-
13
-
## Setup your Docker
14
-
15
-
Install `docker-machine`
16
-
```
17
-
$ brew install docker-machine
18
-
```
19
-
20
-
Then install [VirtualBox](https://www.virtualbox.org/) with [Homebrew Cask](https://github.com/Homebrew/homebrew-cask) to get a driver for your Docker machine
21
-
```
22
-
$ brew cask install virtualbox
23
-
```
24
-
25
-
You may need to enter your password and authorize the application in your `System Settings` > `Security & Privacy`.
26
-
27
-
Create now a new machine, set it up as default and connect your shell to it (here we use zsh. The commands should anyway be displayed in each steps' output)
However, we advise you to export them. That way, you can use [Docker's shorten syntax](https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file) to set your variables.
This package lets you easily integrate the Algolia Search API to your [Django](https://www.djangoproject.com/) project. It's based on the [algoliasearch-client-python](https://github.com/algolia/algoliasearch-client-python) package.
73
73
74
74
You might be interested in this sample Django application providing a typeahead.js based auto-completion and Google-like instant search: [algoliasearch-django-example](https://github.com/algolia/algoliasearch-django-example).
75
75
76
-
- Compatible with **Python 2.7** and **Python 3.4+**.
77
-
- Supports **Django 1.7+**, **2.x** and **3.x**.
76
+
- Compatible with **Python 3.8+**.
77
+
- Supports **Django 4.x** and **5.x**.
78
78
79
79
## Install
80
80
@@ -95,10 +95,10 @@ ALGOLIA = {
95
95
96
96
There are several optional settings:
97
97
98
-
*`INDEX_PREFIX`: prefix all indices. Use it to separate different applications, like `site1_Products` and `site2_Products`.
99
-
*`INDEX_SUFFIX`: suffix all indices. Use it to differentiate development and production environments, like `Location_dev` and `Location_prod`.
100
-
*`AUTO_INDEXING`: automatically synchronize the models with Algolia (default to **True**).
101
-
*`RAISE_EXCEPTIONS`: raise exceptions on network errors instead of logging them (default to **settings.DEBUG**).
98
+
-`INDEX_PREFIX`: prefix all indices. Use it to separate different applications, like `site1_Products` and `site2_Products`.
99
+
-`INDEX_SUFFIX`: suffix all indices. Use it to differentiate development and production environments, like `Location_dev` and `Location_prod`.
100
+
-`AUTO_INDEXING`: automatically synchronize the models with Algolia (default to **True**).
101
+
-`RAISE_EXCEPTIONS`: raise exceptions on network errors instead of logging them (default to **settings.DEBUG**).
102
102
103
103
## Quick Start
104
104
@@ -134,25 +134,17 @@ class YourModelIndex(AlgoliaIndex):
134
134
135
135
```
136
136
137
-
138
-
139
137
# Commands
140
138
141
-
142
-
143
139
## Commands
144
140
145
-
*`python manage.py algolia_reindex`: reindex all the registered models. This command will first send all the record to a temporary index and then moves it.
146
-
* you can pass ``--model`` parameter to reindex a given model
147
-
*`python manage.py algolia_applysettings`: (re)apply the index settings.
148
-
*`python manage.py algolia_clearindex`: clear the index
149
-
150
-
141
+
-`python manage.py algolia_reindex`: reindex all the registered models. This command will first send all the record to a temporary index and then moves it.
142
+
- you can pass `--model` parameter to reindex a given model
143
+
-`python manage.py algolia_applysettings`: (re)apply the index settings.
144
+
-`python manage.py algolia_clearindex`: clear the index
151
145
152
146
# Search
153
147
154
-
155
-
156
148
## Search
157
149
158
150
We recommend using our [InstantSearch.js library](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/) to build your search
Use the `geo_field` attribute to localize your record. `geo_field` should be a callable that returns a tuple (latitude, longitude).
@@ -195,12 +183,8 @@ class ContactIndex(AlgoliaIndex):
195
183
algoliasearch.register(Contact, ContactIndex)
196
184
```
197
185
198
-
199
-
200
186
# Tags
201
187
202
-
203
-
204
188
## Tags
205
189
206
190
Use the `tags` attributes to add tags to your record. It can be a field or a callable.
@@ -212,16 +196,12 @@ class ArticleIndex(AlgoliaIndex):
212
196
213
197
At query time, specify `{ tagFilters: 'tagvalue' }` or `{ tagFilters: ['tagvalue1', 'tagvalue2'] }` as search parameters to restrict the result set to specific tags.
214
198
215
-
216
-
217
199
# Options
218
200
219
-
220
-
221
201
## Custom `objectID`
222
202
223
203
You can choose which field will be used as the `objectID `. The field should be unique and can
224
-
be a string or integer. By default, we use the `pk` field of the model.
204
+
be a string or integer. By default, we use the `pk` field of the model.
225
205
226
206
```python
227
207
classArticleIndex(AlgoliaIndex):
@@ -279,8 +259,8 @@ class ContactIndex(AlgoliaIndex):
279
259
280
260
- With this configuration, you can search for a `Contact` using its `Account` names
281
261
- You can use the associated `account_ids` at search-time to fetch more data from your
282
-
model (you should **only proxy the fields relevant for search** to keep your records' size
283
-
as small as possible)
262
+
model (you should **only proxy the fields relevant for search** to keep your records' size
263
+
as small as possible)
284
264
285
265
## Index settings
286
266
@@ -400,12 +380,8 @@ with disable_auto_indexing(MyModel):
400
380
401
381
```
402
382
403
-
404
-
405
383
# Tests
406
384
407
-
408
-
409
385
## Run Tests
410
386
411
387
To run the tests, first find your Algolia application idand Admin API key (found on the Credentials page).
@@ -414,8 +390,8 @@ To run the tests, first find your Algolia application id and Admin API key (foun
To override settings for some tests, use the [settings method](https://docs.djangoproject.com/en/1.11/topics/testing/tools/#django.test.SimpleTestCase.settings):
394
+
419
395
```python
420
396
class OverrideSettingsTestCase(TestCase):
421
397
def setUp(self):
@@ -433,15 +409,12 @@ class OverrideSettingsTestCase(TestCase):
433
409
# ...
434
410
```
435
411
436
-
437
-
438
412
# Troubleshooting
439
413
440
414
# Use the Dockerfile
415
+
441
416
If you want to contribute to this project without installing all its dependencies, you can use our Docker image. Please check our [dedicated guide](DOCKER_README.md) to learn more.
442
417
443
418
## Frequently asked questions
444
419
445
420
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/framework-integration/django/faq/) where you will find answers for the most common issues and gotchas with the package.
0 commit comments