#22576 closed Bug (fixed)
makemigrations requires 'default' database configuration
Description ¶
According to https://docs.djangoproject.com/en/1.7/topics/db/multi-db/, it is OK use an empty dictionary as the 'default' entry in settins.DATABASES in a multi-database setup, but the makemigations management command insists on it being configured.
To reproduce, do "django-admin startproject mmtest", and edit the settings.py:
class DbRouter(object): def db_for_read(self, model, **hints): return 'nondefault'; db_for_write = db_for_read DATABASE_ROUTERS = ('mmtest.settings.DbRouter', ) DATABASES = { 'default': {}, 'nondefault': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } }
Stacktrace:
(mmtest)vagrant@localhost:~/mmtest$ ./manage.py makemigrations Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 427, in execute_from_command_line utility.execute() File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 419, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/core/management/base.py", line 337, in execute output = self.handle(*args, **options) File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py", line 56, in handle loader.build_graph(ignore_unmigrated=True) File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 148, in build_graph self.applied_migrations = recorder.applied_migrations() File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 48, in applied_migrations self.ensure_schema() File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 38, in ensure_schema if self.Migration._meta.db_table in self.connection.introspection.get_table_list(self.connection.cursor()): File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 162, in cursor cursor = self.make_debug_cursor(self._cursor()) File "/home/vagrant/.virtualenvs/mmtest/local/lib/python2.7/site-packages/django/db/backends/dummy/base.py", line 18, in complain raise ImproperlyConfigured("settings.DATABASES is improperly configured. " django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
Change History (5)
comment:1 by , 11 years ago
Component: | Uncategorized → Migrations |
---|---|
Type: | Uncategorized → Bug |
comment:2 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 11 years ago
Cc: | added |
---|
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
From
django.core.management.commands.makemigrations
:The comment doesn't seem accurate given the traceback.