1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-05 05:05:17 +02:00

PostGIS migration for docker

This commit is contained in:
Sean Morley 2024-08-23 23:49:05 -04:00
parent dab6efbe32
commit e489a70980
6 changed files with 22 additions and 14 deletions

View file

@ -13,7 +13,7 @@ WORKDIR /code
# Install system dependencies
RUN apt-get update \
&& apt-get install -y git postgresql-client \
&& apt-get install -y git postgresql-client gdal-bin libgdal-dev \
&& apt-get clean
# Install Python dependencies

View file

@ -13,6 +13,9 @@ done
>&2 echo "PostgreSQL is up - continuing..."
# run sql commands
# psql -h "$PGHOST" -U "$PGUSER" -d "$PGDATABASE" -f /app/backend/init-postgis.sql
# Apply Django migrations
python manage.py migrate

2
backend/init-postgis.sql Normal file
View file

@ -0,0 +1,2 @@
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;

View file

@ -19,7 +19,7 @@ def setGeometry(region_code):
json_file = os.path.join('static/data', f'{country_code.lower()}.json')
if not os.path.exists(json_file):
print(f'File {country_code}.json does not exist')
print(f'File {country_code}.json does not exist (it probably hasn''t been added, contributors are welcome!)')
return None
try: