I know that I can use using() to select the database defined in settings.py for operations such as:
User.objects.using('users_db').get(id=5).delete()
The problem is that I need to dynamically create / copy / delete several different databases while the server is running (without restarting the server). So that I can change the database configuration in settings.py and select the active database in my code using using() .
Update: Please note that since we have access to the database settings through connections.databases after importing connections from django.db , the main problem is not how to determine the DB in setting.py . I am looking for django ORM commands that can create / copy / delete a database.
source share