I’m building a GeoDjango app but can’t get my server to connect the Postgres database using the PostGIS driver.
I created my app following following the Django getting started guide and opted to automatically create a Postgres database.
I found this this post which seems to imply that PostGIS has been compiled into the Postgres image for awhile.
I can build and run the docker image on my computer, and successfully connect it to a local postgis/postgis:14-3.3 docker container successfully.
fly deploy and ssh into the machine and run
python migrate.py migrate I get a database connection error:
django.db.utils.OperationalError: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.
I tried changing the default database ENGINE from
django.contrib.gis.db.backends.postgis back to
postgresql, which seemed to confirm that this is the issue, as it got further into the migration, but bailed on
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'
Does anyone know what I need to do to get PostGIS up? Can I use the built in fly.io postgres database functionality or do I need to deploy PostGIS from the image?
Thanks in advance.