## how to set up postgis use [docker-postgis](https://github.com/kartoza/docker-postgis) #### setting docker-postgis to use django unit testing 1. get into the running docker shell 2. open postgresql client as postgres user (you have to do this from the command line in the container as you cannot do it remotely) 3. ALTER ROLE \ SUPERUSER; 4. set \ as admin now the admin can run the tests `sudo docker exec -it minyanfinder_development_db bash` #### another more elegant solution to the problem [create extension without superuser role](https://stackoverflow.com/questions/16527806/cannot-create-extension-without-superuser-role) [potential problem if it's not working](https://stackoverflow.com/questions/39556719/django-test-error-creating-the-test-database-permission-denied-to-copy-databas) createdb template_postgis; # create a new database psql -U postgres -c "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis';" # make it a template psql -U postpsql -U postgres -d template_postgis -c "CREATE EXTENSION postgis;" # install postgis in it example: createdb -h localhost -p 49032 -U admin template_postgis psql -h localhost -p 49032 -U admin minyanfinder_dev -c "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis';" psql -h localhost -p 49032 -U admin -d template_gis -c "CREATE EXTENSION postgis;" in local settings file: DATABASES['default']['TEST'] = dict() DATABASES['default']['TEST']['TEMPLATE'] = 'template_postgis'