Opened 12 years ago
Closed 12 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 , 12 years ago
| Has patch: | set |
|---|
comment:2 by , 12 years ago
| Owner: | set to |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
comment:3 by , 12 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → new |
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 , 12 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 , 12 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
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 , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
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.