About Solving PostgreSQL Extension Permission Errors while Running Tests
When trying to run Django unit tests, you might see this error:
psycopg2.errors.InsufficientPrivilege: permission denied
to create extension "postgis"
To fix it, add superuser privilege to your project's database user:
$ psql --username postgres
postgres=# ALTER ROLE my_db_user SUPERUSER;
Another way: create a database template with the extensions.
Tips and Tricks Dev Ops Development Django 6.x Django 5.2 Django 4.2 PostgreSQL PostGIS
Also by me
Django Messaging
For Django-based social platforms.
Django Paddle Subscriptions
For Django-based SaaS projects.
Django GDPR Cookie Consent
For Django websites that use cookies.