How to know current name of the database in Django?

Tested in django 1.9

Go into the shell.

./manage.py shell

Check your databases.

from django import db
db.connections.databases

To get the db name with recent Django versions (tried with 1.8):

from django.db import connection
db_name = connection.settings_dict['NAME']
# Or alternatively
# db_name = connection.get_connection_params()['db']

Be mindful of reading this value after initialization, so that it has the correct value when running unit tests.