#24298: post-migrate handlers fail when DATABASES['default'] = {}
-------------------------------------+-------------------------------------
     Reporter:  trecouvr             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrate              |             Triage Stage:
  post_migrate                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by trecouvr):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Old description:

> 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 settings.py this way:
>

> {{{
> DATABASES = {
>     'default': {},
>     'mysite': {
>         'ENGINE': 'django.db.backends.sqlite3',
>         'NAME': os.path.join(BASE_DIR, 'db_mysite.sqlite3'),
>     }
> }
> }}}
>
> 3. Run `python manage.py migrate --database=mysite`
>
> Problem:
>
> 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.

New description:

 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 settings.py this way:


 {{{
 DATABASES = {
     'default': {},
     'mysite': {
         'ENGINE': 'django.db.backends.sqlite3',
         'NAME': os.path.join(BASE_DIR, 'db_mysite.sqlite3'),
     }
 }
 }}}

 3. Run `python manage.py migrate --database=mysite`

 Problem:

 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:
 https://github.com/trecouvr/test_dj_migrate_174.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24298#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.4460b6d30413362927aab634b3c7547d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to