{"id":15044476,"url":"https://github.com/elastic/pycon-2021-workshop-app-search","last_synced_at":"2025-07-31T17:07:50.120Z","repository":{"id":65978319,"uuid":"354029949","full_name":"elastic/pycon-2021-workshop-app-search","owner":"elastic","description":"Searchable Django Applications with Elastic App Search","archived":false,"fork":false,"pushed_at":"2024-08-08T22:18:48.000Z","size":2628,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-24T02:45:01.038Z","etag":null,"topics":["app-search","elastic-app-search","pycon","pycon2021","python"],"latest_commit_sha":null,"homepage":"https://us.pycon.org/2021/schedule/presentation/45","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elastic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-02T13:37:39.000Z","updated_at":"2023-09-19T05:30:09.000Z","dependencies_parsed_at":"2024-09-25T01:53:40.377Z","dependency_job_id":"86416ce8-1d34-4a9d-9af3-f0b06ab241fe","html_url":"https://github.com/elastic/pycon-2021-workshop-app-search","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/elastic/pycon-2021-workshop-app-search","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fpycon-2021-workshop-app-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fpycon-2021-workshop-app-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fpycon-2021-workshop-app-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fpycon-2021-workshop-app-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elastic","download_url":"https://codeload.github.com/elastic/pycon-2021-workshop-app-search/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fpycon-2021-workshop-app-search/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268074740,"owners_count":24191601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app-search","elastic-app-search","pycon","pycon2021","python"],"created_at":"2024-09-24T20:50:37.896Z","updated_at":"2025-07-31T17:07:50.090Z","avatar_url":"https://github.com/elastic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Searchable Django Applications with Elastic App Search (PyCon US 2021)\n\n## Where are the slides for the Workshop?\n\n[Here they are!](https://github.com/elastic/pycon-2021-workshop-app-search/blob/main/slides.pdf)\n\n## What to do before the Workshop?\n\n- Fork / Clone the repository\n\n  - `$ git clone https://github.com/elastic/pycon-2021-workshop-app-search`\n  - `$ cd pycon-2021-workshop-app-search` \n\n- Create a virtual environment and install all\n  dependencies in `requirements.txt`:\n  \n  - `$ python -m venv venv`\n  - `$ source venv/bin/activate`\n  - `$ (venv) python -m pip install -r requirements.txt`\n\n- [Start an Enterprise Search instance](#starting-an-enterprise-search-instance). There are two\n  options here:\n  - Create an Elastic Cloud account (comes with a 14 day free trial no credit card required)\n  - Install `docker-compose` and use `docker-compose up` to start an Enterprise Search instance locally\n\n- Update the `url` and `private_key` values in `config.yml` \n  per the instructions for starting the Enterprise Search instance below.\n\n- Make sure at least `examples/example_1_making_requests.py`\n  is able to run completely. You should see the message\n  `Everything worked! :-)` in your terminal. All examples are\n  meant to be run via `python examples/example_N_...py` or\n  via the \"Run\" functionality in your IDE.\n\n## Starting an Enterprise Search instance\n\n### Elastic Cloud\n\n- Create an [Elastic Cloud account](https://www.elastic.co/cloud)\n- Create a new Deployment using the \"Enterprise Search\" template\n- Select a cloud provider and region and select `Create Deployment`.\n  The instance will be provisioned and available in a few minutes\n- Click `Launch` or `Copy Endpoint` in the new deployment overview\n  and copy the URL (minus the `/login` path). The result should look like\n  approximately this: `https://(deployment name)-1a6dc7.ent.us-west1.gcp.cloud.es.io`\n- Open `config.yml` and set `url` field to be `\"https://(deployment name)-1a6dc7.ent.us-west1.gcp.cloud.es.io\"`\n  and run the script and ensure it passes without error.\n- Select `Launch App Search`, from here you'll be placed in a getting started\n  screen. You can follow these steps if you'd like otherwise you can\n  select `Skip Onboarding` in the top.\n- That's it, you're now in App Search!  \n\n### Docker Compose\n\n- Download and install [docker-compose](https://docs.docker.com/compose)\n- With an open terminal in the cloned git repository run `docker-compose up`.\n  Wait for all services to spin up and configure for the first time which may take a minute.\n- You should be able to connect to `http://localhost:3002` in a browser\n- Open `config.yml` and set `url` field to be `\"http://localhost:3002\"`\n  and run the script and ensure it passes without error.\n- The username will be `enterprise_search` and the password will be `changeme`.\n- Select `Launch App Search`, from here you'll be placed in a getting started\n  screen. You can follow these steps if you'd like otherwise you can\n  select `Skip Onboarding` in the top.\n- That's it, you're now in App Search!  \n\n### Finding your Private Key\n\n- When in App Search, navigate to the `Credentials` tab\n- Click the `Copy to Clipboard` button next to the Private Key\n- Paste the value into the `private_key` field in `config.yml`\n\n## Getting Started with the Django App\n\n### Setup\n\n- Ensure your virtualenv is activated and `requirements.txt` is installed\n- Change directory into `django/`\n- Run `python manage.py migrations` to create `db.sqlite3`\n- Run `python manage.py runserver` to start the server on `http://localhost:8000`.\n  Don't use these exact configurations in production!\n- Access [`http://localhost:8000/reset`](http://localhost:8000/reset) to load data into the Django database\n\n### URLs of Interest\n\n- [`http://localhost:8000/\u003cpark-id\u003e`](http://localhost:8000/park-acadia) Shows a park by ID within the Django database\n- [`http://localhost:8000/search`](http://localhost:8000/search) Has the Reference UI configured for App Search\n- [`http://localhost:8000/remove-park`](http://localhost:8000/remove-park) Removes `park-acadia` from the Django database, see how signals keep App Search up to date.\n- [`http://localhost:8000/add-park`](http://localhost:8000/add-park) Adds `park-acadia` from the Django database, see how signals keep App Search up to date.\n- [`http://localhost:8000/remove-m2m`](http://localhost:8000/remove-m2m) Removes the state `Tennessee` from `park-great-smoky-mountains`, see how signals keep App Search up to date.\n- [`http://localhost:8000/add-m2m`](http://localhost:8000/add-m2m) Adds the state `Tennessee` to `park-great-smoky-mountains`, see how signals keep App Search up to date.\n- [`http://localhost:8000/reset`](http://localhost:8000/reset) Resets the Django database to its original set of data (takes a while because we're not using background tasks)\n- [`http://localhost:8000/run-task`](http://localhost:8000/run-task)\n  Runs the background task to index documents from the database into a new source engine and update a meta engine.\n\n### Indexing Models into App Search\n\nSee `django/parks/models.py` for the signals approach to indexing documents in App Search.\nSee `django/parks/tasks.py` for the tasks approach to indexing documents in App Search.\n\nWhen doing this in real life I recommend using background tasks\nfor signal handlers to avoid blocking web requests.\n\n### Reference UI\n\nThe [Reference UI](https://github.com/elastic/app-search-reference-ui-react) has been generated and the production compressed JS and CSS are stored in `django/static/`.\nWhen you're creating your own Reference UI you should not copy these and instead follow the instructions\non the Reference UI repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fpycon-2021-workshop-app-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felastic%2Fpycon-2021-workshop-app-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fpycon-2021-workshop-app-search/lists"}