About Solving PostgreSQL Extension Permission Errors while Running Tests

When trying to run Django unit tests, you might see this error:

1
2
psycopg2.errors.InsufficientPrivilege: permission denied 
to create extension "postgis"

To fix it, add superuser privilege to your project's database user:

1
2
$ psql --username postgres
postgres=# ALTER ROLE my_db_user SUPERUSER;

Tips and Tricks Dev Ops Development Django 4.2 Django 3.2 Django 2.2 PostgreSQL PostGIS