A simple tutorial, showing how to quickly and easily use ElasticSearch as the data store for a simple application (in this case a simple blogging engine)
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
simple Add support for admin screens, better mapping May 7, 2013
templates initial import Mar 25, 2013
.gitignore initial import Mar 25, 2013
README.md updated logo Mar 26, 2013
__init__.py initial import Mar 25, 2013
apikey.txt initial import Mar 25, 2013
manage.py initial import Mar 25, 2013
requirements.txt initial import Mar 25, 2013
settings.py initial import Mar 25, 2013
test.sql initial import Mar 25, 2013
urls.py initial import Mar 25, 2013

README.md

Simple Django and ElasticSearch Tutorial

![OpenCrowd][1] [1]: https://secure.gravatar.com/avatar/ec08b78d5a9c25a3d78a0b5d471fad83?s=420&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png

Requirements

  1. An ElasticSearch instance
  2. Python & Django >= 1.4

Setup

  1. Clone this repo

git clone git://github.com/opencrowd/elasticsearch-tutorial.git

  1. Create the ElasticSearch type mappings

python manage.py put_mappings

  1. Run the server

python manage.py runserver

  1. Point your browser at http://localhost:8000/simple/

How It Works

The project's views are defined in views.py. The functions that query and store data into ElasticSearch are defined in models.py; these are purposefully kept minimal.

This project barely uses the Django ORM -- it uses it for the django.contrib.auth User model. By default, it uses sqllite3 for this; you can (and should) configure it to point at an appropriate database configuration.

You can control the ElasticSearch index and connection via the ELASTICSEARCH_URL and ELASTICSEARCH_INDEX variables in settings.py. These default to 'http://localhost:9200' and 'blog' respectively.

The only "fancy" thing that this tutorial app does beyond ElasticSearch CRUD-type operations is using akismet for spam detection for comments. You should put your akismet key information in the apikey.txt file. If you don't want to use akismet, you can disable that in settings.py defining USE_AKIMSET as False.

The web templates are kept purposefully simple, using bare minimum bootstrap functionality.