Database Reference
In-Depth Information
Chapter 9
Neo4j + Python
This chapter focuses on using Python with Neo4j and reviewing the code for a working application that integrates the
five graph model types covered in Chapter 3. As with other languages that offer a driver for Neo4j, the integration takes
place using a Neo4j server instance with the Neo4j REST API. This chapter is divided into the following topics:
Python and Neo4j Development Environment
Py2neo
Developing a Python and Neo4j application
In each chapter that explores a particular language paired with Neo4j, I recommend that you start a free trial on
www.graphstory.com or have installed a local Neo4j server instance as shown in Chapter 2.
To quickly set up a server instance with the sample data and plugins for this chapter, go to graphstory.com/
practicalneo4j . You will be provided with your own free trial instance, a knowledge base, and email support from
Graph Story.
Tip
For this chapter, I assume that you have a good understanding of HTML, JavaScript, and CSS, at least a beginning
knowledge of Python, and a basic understanding of how to configure Python for your preferred operating system. To
proceed with the examples in this chapter, I recommend you install and configure Python 2.7. While the examples
should work with later versions of Python with some modifications, Python 2.7 is the version used in this chapter. In
addition, the sample application uses the Apache HTTP server and wsgi_module.
If you do not have Apache HTTP installed, it is highly recommended that you follow the instructions at
http://httpd.apache.org/ based on your operating system. Configuring Python and the wsgi_module with a local
instance of Apache HTTP is beyond the scope of this topic, but the basic configuration steps can be found at
https://code.google.com/p/modwsgi/ .
Do This
I also assume that you have a basic understanding of the model-view-controller (MVC) pattern and some
knowledge of Python frameworks that provide an MVC pattern. There are, of course, a number of excellent Python
frameworks from which to choose, but I had to pick one for the illustrative purposes of the application in this chapter.
I chose the Bottle framework because it is limited in its scope and allows the focus to remain on the application to the
greatest extent possible. This chapter is focused on integrating Neo4j into your Python skill set and projects and does
not dive deeply into the best practices of developing with Python or Python frameworks.
 
 
Search WWH ::




Custom Search