Skip to content
This repository

Tutorial to set up a new Django project with neo4j-embedded Python bindings.

branch: master

Neo4j and Django tutorial

This is not the way to do it, just a way but the only way using the new neo4j-embedded Python bindings that I have seen. This tutorial is written for Ubuntu (10.10) but it should work for any GNU Linux flavor and I have seen a similar setup in OS X.


Download a sample database, I will use the Twitter database from (

Download jpype ( (

Install python-virtualenv.

sudo apt-get install virtualenv

Clone my neo4j-django-tutorial git repository.

git clone git://
cd neo4j-django-tutorial

Create a new virtual python environment.

virtualenv --no-site-packages env

Activate your environment.

source env/bin/activate

Install openjdk-6-jdk and python-dev packages.

sudo apt-get install openjdk-6-jdk python-dev

Set your JAVA_HOME evironment variable.

export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/

Build and install JPype.

pip install /path/to/

Install Django (1.3.1) and neo4j-embedded Python bindings (1.6.b1).

pip install django neo4j-embedded

Make a directory to hold the neo4j database.

mkdir neo4jdb

Unzip to the neo4jdb directory.

unzip -d neo4jdb

Starting the tutorial app

Copy neo4jtut/ to neo4jtut/ and change the path on line 14 to the path matching your system.

NEO4JTUT_ROOT = '/path/to/neo4j-django-tutorial'

Sync the SQL database and start the development server.

python neo4jtut/ syncdb
python neo4jtut/ runserver

Open http://localhost:8000 in your favorite browser.

Going forward

Start a new Django project and create a new app. project_name project_name app_name

Have a look in the neo4jtut projects and file for some tips on how to I use Neo4j and Django.

Pro tips :)

Some tips when I remember them.


If you don't use it, start now. If you have it installed in your virtualenv the Django shell uses it.

Install IPython

pip install ipython
# In your project directory run
python shell


To make it easier to use the Lucene indexes you should install lucene-querybuilder (0.1.5).

pip install lucene-querybuilder
Something went wrong with that request. Please try again.