Running Django-Neomodel Within a Docker Container

Here’s your quickstart guide for posterity, using the example in Django-Neomodel.

Cristina
Neo4j Developer Blog
3 min readMay 26, 2021

--

A Neomodel community member asked about how to run Django Neomodel (a Neomodel plugin for Django) within a Docker container. So let’s show how to do it.

Photo by frank mckenna on Unsplash

Haven’t tried out Django-Neomodel yet? Start here.

Local Setup — Example

Prerequisites:

The Django-Neomodel repository comes with a Docker example. If you’re just getting started with Docker, this may be a good place to start.

From the root of the Django-Neomodel repo, go to the tests directory:

Run the Docker Command (make sure your Docker service is running and up to date).

Verify the Django admin is running: http://localhost:8000/admin/

Verify Neo4j Browser is running: http://localhost:7474/browser/

You’ll be then able to log in with the test credentials admin / 1234.

Under the Hood

Dockerfile

The Dockerfile collects the commands Docker will be using to create your environment.

docker-compose.yml

docker-compose.yml is where you’ll configure the ports you’ll be using to communicate with your Neo4j database.

docker-compose.yml :

docker-entrypoint.sh

docker-entrypoint.sh is where you’ll configure the python/Django portion of your app. You’ll add your DJANGO_SUPERUSER_USERAME and other Django-related environment variables here.

docker-entrypoint.sh :

Resources

About the Authors

Cristina and Alisson work at The SilverLogic, a software development company based in Boca Raton.

Alisson is a software engineer at The SilverLogic. Passionate about plants, he is the driving force behind Que Planta, a GraphQL-based social network for plants.

--

--