cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Neo4j in Django project with multiple databases

Hello everyone!
I am creating a Django project and I want to store user data in a relational database and all my resources in a neo4j database using django-neomodel (https://github.com/neo4j-contrib/django-neomodel).
The documentation states that the main settings to integrate neo4j are the NEOMODEL_NEO4J_BOLT_URL = os.environ.get('NEO4J_BOLT_URL', 'bolt://neo4j:test@localhost:7687') and adding "django_neomodel" to the installed apps. There is no change to the Database settings section.
However, the documentation for using multiple databases in Django (https://docs.djangoproject.com/en/1.11/topics/db/multi-db/#allow_migrate) requires defining your databases settings. Hence, I am wondering how to integrate multiple databases with neo4j.
Would the project use the neo4j database by default for models defined using neomodel without the need to define it in the databases section?

Thank you very much in advance!

1 REPLY 1

FourMoBro
Node Clone

I setup my app initially this same way. Django is basically managing access to Neo4j by managing users in its default sqlite3 database. Django is also rendering all the html files within the "app". The models.py within the app was originally setup with django_neomodel, but this was not necessary. If you are not creating a model class referencing models.Model nothing will be stored in the sqlite3 database. And no, you do not have to specify the additional database in the settings.py file. In short, I have the Neo4j driver sends a bunch of queries or mutations written in cypher to mimic basic CRUD type operations, then django just renders the result in the html. It is a lot of writing and I can't seem for the life of me to get the graphene(graphQL) to retrieve the nodes which could make things easier, but that is for another thread.