[Django] #24332: Sites migration fails when DATABASES['default'] = {}

9 views
Skip to first unread message

Django

unread,
Feb 12, 2015, 10:06:38 AM2/12/15
to django-...@googlegroups.com
#24332: Sites migration fails when DATABASES['default'] = {}
----------------------------+----------------------------------
Reporter: trecouvr | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords: migrate post_migrate
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+----------------------------------
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.
More details can be found on https://code.djangoproject.com/ticket/24298.

To reproduce 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 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/24332>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 12, 2015, 10:13:02 AM2/12/15
to django-...@googlegroups.com
#24332: Sites migration fails 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 timgraham):

* 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.
> More details can be found on https://code.djangoproject.com/ticket/24298.
>
> To reproduce 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 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.

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.
More details can be found on https://code.djangoproject.com/ticket/24298.

To reproduce 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 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.

--

Comment:

This seems to be a duplicate of #24298 which was fixed (did you try this
on the stable/1.7.x branch?). Markus asked you to open a new issue for
`create_default_site()` not propagating the `using` parameter. Did you
misunderstand him or am I misunderstanding you?

--
Ticket URL: <https://code.djangoproject.com/ticket/24332#comment:1>

Django

unread,
Feb 12, 2015, 10:42:50 AM2/12/15
to django-...@googlegroups.com
#24332: Sites migration fails 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
-------------------------------------+-------------------------------------

Comment (by trecouvr):

I am not sure if I misunderstood him or not, but I get the error reported
on this ticket with branch stable/1.7.x and this is not exactly the same
as mentioned in #24298. This looks like the same as #24298 but the root
cause is not the same (The root cause of #24298 is the post_migrate call
related to the 'auth' application whereas here the error is related to the
'sites' application).

--
Ticket URL: <https://code.djangoproject.com/ticket/24332#comment:2>

Django

unread,
Feb 12, 2015, 10:46:40 AM2/12/15
to django-...@googlegroups.com
#24332: Sites migration fails when DATABASES['default'] = {}
-------------------------------------+-------------------------------------
Reporter: trecouvr | Owner: timgraham
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: migrate | Triage Stage: Accepted
post_migrate |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* owner: nobody => timgraham
* status: new => assigned
* stage: Unreviewed => Accepted


Comment:

Oh, I see, will look at this.

--
Ticket URL: <https://code.djangoproject.com/ticket/24332#comment:3>

Django

unread,
Feb 12, 2015, 2:02:18 PM2/12/15
to django-...@googlegroups.com
#24332: Sites migration fails when DATABASES['default'] = {}
-------------------------------------+-------------------------------------
Reporter: trecouvr | Owner: timgraham
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7

Severity: Normal | Resolution:
Keywords: migrate | Triage Stage: Accepted
post_migrate |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1
* needs_tests: 0 => 1


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.
> More details can be found on https://code.djangoproject.com/ticket/24298.
>
> To reproduce 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 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.

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.
More details can be found on https://code.djangoproject.com/ticket/24298.

To reproduce 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 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.

--

Comment:

[https://github.com/django/django/pull/4120 PR] (not sure about tests at
the moment)

--
Ticket URL: <https://code.djangoproject.com/ticket/24332#comment:4>

Django

unread,
Feb 12, 2015, 5:17:22 PM2/12/15
to django-...@googlegroups.com
#24332: Sites migration fails when DATABASES['default'] = {}
-------------------------------------+-------------------------------------
Reporter: trecouvr | Owner: timgraham
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7

Severity: Normal | Resolution:
Keywords: migrate | Triage Stage: Accepted
post_migrate |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_tests: 1 => 0


Comment:

Tests added.

--
Ticket URL: <https://code.djangoproject.com/ticket/24332#comment:5>

Django

unread,
Feb 12, 2015, 8:25:42 PM2/12/15
to django-...@googlegroups.com
#24332: Sites migration fails when DATABASES['default'] = {}
-------------------------------------+-------------------------------------
Reporter: trecouvr | Owner: timgraham
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7
Severity: Release blocker | Resolution:

Keywords: migrate | Triage Stage: Accepted
post_migrate |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* severity: Normal => Release blocker


--
Ticket URL: <https://code.djangoproject.com/ticket/24332#comment:6>

Django

unread,
Feb 13, 2015, 7:02:36 AM2/13/15
to django-...@googlegroups.com
#24332: Sites migration fails when DATABASES['default'] = {}
-------------------------------------+-------------------------------------
Reporter: trecouvr | Owner: timgraham
Type: Bug | Status: closed
Component: Migrations | Version: 1.7
Severity: Release blocker | Resolution: fixed

Keywords: migrate | Triage Stage: Accepted
post_migrate |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"e8cf4f8abec87b9da6ed8e5c8cf833af9b27f4dd"]:
{{{
#!CommitTicketReference repository=""
revision="e8cf4f8abec87b9da6ed8e5c8cf833af9b27f4dd"
Fixed #24332 -- Fixed contrib.sites create_default_site() when 'default'
DATABASES is empty.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24332#comment:7>

Django

unread,
Feb 13, 2015, 7:12:33 AM2/13/15
to django-...@googlegroups.com
#24332: Sites migration fails when DATABASES['default'] = {}
-------------------------------------+-------------------------------------
Reporter: trecouvr | Owner: timgraham
Type: Bug | Status: closed
Component: Migrations | Version: 1.7

Severity: Release blocker | Resolution: fixed
Keywords: migrate | Triage Stage: Accepted
post_migrate |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"1b93b0977d2fa7d3cca2fb64168655582e7a88f9"]:
{{{
#!CommitTicketReference repository=""
revision="1b93b0977d2fa7d3cca2fb64168655582e7a88f9"
[1.7.x] Fixed #24332 -- Fixed contrib.sites create_default_site() when
'default' DATABASES is empty.

Backport of e8cf4f8abec87b9da6ed8e5c8cf833af9b27f4dd from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24332#comment:8>

Django

unread,
Feb 13, 2015, 7:12:38 AM2/13/15
to django-...@googlegroups.com
#24332: Sites migration fails when DATABASES['default'] = {}
-------------------------------------+-------------------------------------
Reporter: trecouvr | Owner: timgraham
Type: Bug | Status: closed
Component: Migrations | Version: 1.7

Severity: Release blocker | Resolution: fixed
Keywords: migrate | Triage Stage: Accepted
post_migrate |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"4c948c7c9d8b8bb4a36f703a6e96de5914740b0f"]:
{{{
#!CommitTicketReference repository=""
revision="4c948c7c9d8b8bb4a36f703a6e96de5914740b0f"
[1.8.x] Fixed #24332 -- Fixed contrib.sites create_default_site() when
'default' DATABASES is empty.

Backport of e8cf4f8abec87b9da6ed8e5c8cf833af9b27f4dd from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24332#comment:9>

Reply all
Reply to author
Forward
0 new messages