Opened 11 years ago

Closed 11 years ago

#21856 closed Bug (fixed)

Crash when DATABASES = {}

Reported by: Aymeric Augustin Owned by: Andrew Godwin
Component: Migrations Version: dev
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As of 1d20e6df9553346c79edd92e6e8934e9c5c4aa2c it isn't possible to run Django with DATABASES = {} any more.

Change History (6)

comment:1 by Mark Lavin, 11 years ago

Has patch: set

I've sent a PR to fix this issue: https://github.com/django/django/pull/2244 This moves the check for unapplied migrations out of the runserver command and uses the new system checks framework instead.

comment:2 by Andrew Godwin <andrew@…>, 11 years ago

Owner: set to Andrew Godwin <andrew@…>
Resolution: fixed
Status: newclosed

In 38b4adc6960d28483124509aa363dadbe8cc17a6:

Merge pull request #2244 from mlavin/21856-migration-checks

Fixed #21856: Allow Empty DATABASES Setting

comment:3 by Ryan Kaskel, 11 years ago

Resolution: fixed
Status: closednew

When running the tests, I am getting a warning from the new check command:

 ./manage.py test
Creating test database for alias 'default'...
System check identified some issues:

WARNINGS:
?: You have unapplied migrations; your app may not work properly until they are applied.
        HINT: Run 'python manage.py migrate' to apply them.
.
----------------------------------------------------------------------
Ran 1 test in 0.008s

OK
Destroying test database for alias 'default'...

But notice no warnings are emitting when just running check:

$ ./manage.py check
System check identified no issues (0 silenced).

It seems confused because the checks are running before the tests are migrated.

I think it has something to do with this commit: https://github.com/django/django/commit/0ac13eccebb3d879f79b31585b1e81f655067179

comment:4 by Mark Lavin, 11 years ago

I wasn't seeing this when running the Django test suite. I see this warning is also issued when you run migrate from #22031 which isn't wanted. I don't agree with the resolution that this doesn't belong in the checks framework. This fits precisely into its stated purpose.

The system check framework is a set of static checks for validating Django projects. It detects common problems and provides hints for how to fix them.

There should be a way to suppress this check when it is not known to not be relevant such was when running migrate.

comment:5 by Andrew Godwin, 11 years ago

Owner: changed from Andrew Godwin <andrew@…> to Andrew Godwin
Status: newassigned

On the contrary, I think this is only relevant when running runserver - not having applied migrations is a valid state for a Django project and is only really of concern if you are trying to run the website and interact with it (and even then you might want it).

I'm going to move it back from being a check and fix it a different way.

comment:6 by Andrew Godwin <andrew@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In f0f1ba75b090e533c1b39f516cea2d9a15307ac3:

Fixed #21856: Don't crash runserver when DATABASES = {}

Note: See TracTickets for help on using tickets.
Back to Top