i have different configurations for django database in settings, one named "default" and one named "clean".
How i can run the development server (python manage.py runserver ip:port
) binding the "clean" database setting and not the default?
Django's admin doesn't have any explicit support for multiple databases. If you want to provide an admin interface for a model on a database other than that specified by your router chain, you'll need to write custom ModelAdmin classes that will direct the admin to use a specific database for content.
You can hold 2 different settings.py and while run manage.py do : python manage.py runserver --settings=[projectname].[settingsfile].
change the settingsfile according to your database.
if DEBUG:
DATABASES = {
'clean': {
'ENGINE': 'django.db.backends.',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
},
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
},
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With