Opened 9 years ago

Closed 9 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


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

Change History (6)

comment:1 Changed 9 years ago by Mark Lavin

Has patch: set

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

comment:2 Changed 9 years ago by Andrew Godwin <andrew@…>

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 Changed 9 years ago by Ryan Kaskel

Resolution: fixed
Status: closednew

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

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

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

Destroying test database for alias 'default'...

But notice no warnings are emitting when just running check:

$ ./ 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:

comment:4 Changed 9 years ago by Mark Lavin

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 Changed 9 years ago by Andrew Godwin

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 Changed 9 years ago by Andrew Godwin <andrew@…>

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