Giter Club home page Giter Club logo

es-django-example's Introduction

Stack

Example application in Django using Elasticsearch DSL for search.

It uses data from StackExchange dumps (https://archive.org/details/stackexchange) - download the torrent and just point the load_dump command to an unpacked data directory for a stack exchange server.

To install:

# install requirements
pip install -r requirements.txt

# create database
python manage.py migrate

# load SE dump into the DB
python manage.py load_dump DIR

# index all data into elasticsearch
python manage.py index_data

To perform search just go to http://localhost:8000/search/?tags=flavor&tags=beans&q=bitterness.

Docker workflow

To develop on this project make sure you Docker an Docker Compose installed.

To get started just run:

docker-compose up -d

wait till the elastic cluster is healthy:

$ docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                 PORTS                       NAMES
d25832cf31db        e62bf4ebda11                "python manage.py ..."   About an hour ago   Up About an hour       0.0.0.0:80->80/tcp          esdjangoexample_web_1
98a60d2d200c        fxdgear/elasticsearch:5.4   "/docker-entrypoin..."   2 hours ago         Up 2 hours (healthy)   9200/tcp, 9300/tcp          esdjangoexample_elasticsearch_1

Once healthy you can access the web container by running:

docker exec --it esdjangoexample_web_1 ash

Then you can create the database by running:

python manage.py migrate

Then you can load the SE dump into the data base:

python manage.py load_dump DIR

Then you can index the data:

python manage.py index_data

Now you can naviaget to http://localhost

Deploying with docker swarm

Build and push the image to the repository:

docker-compose build
docker-compose push

To deploy this with docker swarm. Make sure you have access to a swarm cluster and simply run:

docker stack deploy --compose-file docker-compose.prod.yml es-django-example

es-django-example's People

Contributors

honzakral avatar fxdgear avatar karmi avatar varunpurohit76 avatar adamtheturtle avatar aavrug avatar

Watchers

James Cloos avatar Manoj Gautam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.