I am using django admin to facilitate editing a database. Recently, we have added another database so using the default in DATABASES in the settings file would not make sense any more.
I now have this in my settings.py file:
DATABASES = {
'default': {},
'animal_tracking': {
'ENGINE':'django.db.backends.mysql',
'NAME': 'AnimalTracking',
'USER': 'foo',
'PASSWORD': 'bar',
'HOST': '127.0.0.1',
'PORT': '3306',
},
'animal_information': {
'ENGINE':'django.db.backends.mysql',
'NAME': 'AnimalInformation',
'USER': 'foo',
'PASSWORD': 'bar',
'HOST': '127.0.0.1',
'PORT': '3306',
},
}
My admin.py file contains:
from django.contrib import admin
from animal_tracking.models import at_animal_types, at_animals
# Register your models here.
class AnimalTypesAdmin(admin.ModelAdmin):
# Sets how the fields are displayed in the add / change section.
fieldsets = [
(None, {'fields': ['type', ]}),
]
# Sets what fields to be displayed in the change (view) section.
list_display = ('type', )
# Registers the current model administration to the admin page.
admin.site.register(at_animal_types, AnimalTypesAdmin)
class AnimalsAdmin(admin.ModelAdmin):
# Sets how the fields are displayed in the add / change section.
fieldsets = [
(None, {'fields': ['tracker_id', 'type', ]}),
('Log information (should not change)', {'fields': ['last_log', 'last_bat', 'last_lat', 'last_lon', ], 'classes': ['collapse']}),
]
# Sets what fields to be displayed in the change (view) section.
list_display = ('tracker_id', 'type', 'last_log', 'last_bat', 'last_lat', 'last_lon', )
# Sets what fields to allow filtering by.
list_filter = ['type', ]
# Sets what fields to allow searching by. Use table__field if foreign key.
search_fields = ['tracker_id', 'type__type', ]
# Registers the current model administration to the admin page.
admin.site.register(at_animals, AnimalsAdmin)
Initially, the admin section would connect with the default database. But now that I removed the default and added the other 2 databases, I'm getting the following error:

If I copy the settings of animal_tracking to default, it works. My question therefore is:
How can I specify which database django admin should use?
Thank you!