PostGIS migration for docker
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
2
backend/init-postgis.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
CREATE EXTENSION IF NOT EXISTS postgis_topology;
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user