From 6dfa65ee77c7330f747b9accce850942237ac6e8 Mon Sep 17 00:00:00 2001 From: Dana Lambert Date: Fri, 15 Oct 2021 14:31:52 +1300 Subject: [PATCH] Add django gis extension --- backend/Dockerfile | 10 ++++++++++ backend/right_tree/settings.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 850475b..fb85742 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -6,6 +6,16 @@ ENV DJANGO_SUPERUSER_PASSWORD=admin WORKDIR /app +RUN apt update && \ + apt install -y --no-install-recommends \ + gdal-bin \ + libxml2 libxml2-dev gettext \ + libxslt1-dev libjpeg-dev libpng-dev libpq-dev libgdal-dev \ + software-properties-common g++ \ + zlib1g-dev libgeos-dev libproj-dev \ + sqlite3 spatialite-bin libsqlite3-mod-spatialite && \ + apt clean + COPY ./requirements.txt /app/requirements.txt RUN pip install -U --no-cache-dir -r requirements.txt diff --git a/backend/right_tree/settings.py b/backend/right_tree/settings.py index 0f127e6..e5cecaf 100644 --- a/backend/right_tree/settings.py +++ b/backend/right_tree/settings.py @@ -37,6 +37,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django.contrib.gis', 'rest_framework', 'corsheaders', @@ -81,7 +82,7 @@ WSGI_APPLICATION = 'right_tree.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.postgresql', + 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'right_tree', 'USER': 'postgres', 'PASSWORD': 'postgres',