Skip to content

laitang2000/docker-django-postgis

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker / Django / Postgis

The goal of this repository is to test Docker to work with Django and PostGIS.

Requirements

The only things you need to do before continue is installing Docker.

I decided to not use an existing Docker images for Postgres or PostGIS because the best way to learn and understand how Docker can help me, is to write code and to search how to resolve problems.

But if you're lookin for a Postgres or PostGIS image, this repository is not for you. You can use the official Postgres repo or one of the already available PostGIS repos

How to use this repository

This repository is build like a tutorial, with several steps. Each step is a git branch you can checkout (eg git checkout step1)

The steps

  1. Create a basic Postgres image (branch step1)
  2. Enforce security to the Postgres container adding a user/password. Create a database (step2)
  3. Create a PostGIS image (step3)
  4. Create a Django App (step4)

Create a basic Postgres image

Checkout the step1 branch

$ git checkout step1

The Postgres image is located in the postgres repository. Read the Postgres README for detailled instructions on how to build and run the container.

Update the Postgres image

Checkout the step2 branch

$ git checkout step2

This step update the Postgres image allowing the definition of the database name. You can also create a user and a password. See the Postgres README for details on how to build and run the container, and to see how to defines the environment variables.

Create a PostGIS image

Checkout the step3 branch

$ git checkout step3

In this step, we update the Postgres image to allow the execution of scripts added by child containers, and we create a PostGIS image based on our Postgres image.

The detailled instruction about the PostGIS image are in the PostGIS README.

The Django App

I use the geodjango tutorial.

I use Compose to set-up and run the app.

In addition to the steps of the geodjango tutorial, I created the 3 following files:

Detailed instructions to set-up and run the geodjango app are in the geodjango README

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 77.5%
  • Shell 22.5%