Opened 8 years ago

Last modified 8 years ago

#24298 closed Bug

post-migrate handlers fail when DATABASES['default'] = {} — at Version 1

Reported by: Thomas Recouvreux Owned by: nobody
Component: Migrations Version: 1.7
Severity: Release blocker Keywords: migrate post_migrate
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Thomas Recouvreux)

On Django 1.7.4 the management command migrate --database=xxx fails when DATABASES['default'] = {} with django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details..
On Django 1.7.3 it works fine.

To reproduct the problem:

  1. Create a new project
  2. Edit the this way:
    'default': {},
    'mysite': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db_mysite.sqlite3'),
  1. Run python migrate --database=mysite


It seems Django tries to access the default connection. I found django.db.migrations.loader.is_latest_migration_applied uses the default connection.

I am attaching an output log of the command.
Here is a sample project to reproduce the behaviour:

Change History (2)

comment:1 Changed 8 years ago by Thomas Recouvreux

Description: modified (diff)

Changed 8 years ago by Thomas Recouvreux

Attachment: migrate_failure.log added
Note: See TracTickets for help on using tickets.
Back to Top