ella/django-markup — comment on commit 299e3dc8cff3c82d187487c33637d2c0d0dd484f
File:  line 0
By HonzaKral:

Just import django.db.backend (or better yet, get the connection for the model in question) and check the module path if it's psycopg2. It's still a hack but I guess a needed one.

This way you are independent on the loading mechanism (DATABASES vs DATABASE_ENGINE).

Alternatively look for django.db.connection.settings_dict['ENGINE']