Skip to content
This repository

Example of using Python, Flask and neo4j on Heroku

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 static
Octocat-spinner-32 templates
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Procfile
Octocat-spinner-32 complexqueries.cfg
Octocat-spinner-32 requirements.txt

Python + Flask + neo4j on Heroku Example

I put this project together as an entry for the Heroku neo4j challenge and it should be fairly easy to get a feel for how to integrate neo4j into an app of your own or use as a base for a new app. Check out the demo app to see it in action.

The app is a simple data explorer with bookmarking ability to show off some of the features of neo4j. A subset of data from a Stack Exchange CC data dump, specifically Programers Stack Exchange, is used to populate a sample database. The bookmarking feature allows for weights to be added for later use in recomendations.

For more details about the the app check out the wiki page.

I'm using the following stack on the server side:

  • Python
  • Flask web microframework
  • neo4j graph database
  • py2neo neo4j python library

I'm using the following stack on the client side:

If you find this code helpful take a minute and rate it on Gensen. If you want to use this code as a base for another project take a look at the comments labeled "neo4j note" for hints on what might be most useful.

Deploying Localy

There are a few requirements for the app to run:

After verifing that requirements are ready the following should get things running:

git clone
cd Python-Flask-neo4j-Heroku-Example
virtualenv venv --distribute
source venv/bin/activate
pip install -r requirements.txt
# The following command will take a while to run but will produce output as it does
# Once the load is complete the app is ready to run

You can also use Foreman to run locally.

Heroku Deployment

git clone
cd Python-Flask-neo4j-Heroku-Example
virtualenv venv --distribute
source venv/bin/activate
pip install -r requirements.txt
heroku create --stack cedar
heroku addons:add neo4j
heroku scale web=0
git push heroku master
# This next step will take a while, maybe 30 minutes monitor it with the "heroku logs" command
heroku run:detached python 
# Once the load has completed
heroku scale web=1

See the Heroku Python howto for more information.


See the LICENSE file.

Something went wrong with that request. Please try again.