#21284 closed Bug (fixed)
Errors in the settings.py file result in misleading messages
Reported by: | Anand Kumria | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.6-beta-1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
If you have an error in your settings.py, Django 1.6 will give an error indicating that whatever command you are attempting to run does not exist.
$ django-admin.py startproject djtest .
$ python manage.py validate
0 errors found
Now edit djtest/settings.py and put the following in the file:
diff -u djtest.orig/settings.py djtest/settings.py
--- djtest.orig/settings.py 2013-10-17 14:18:51.348674346 +0100
+++ djtest/settings.py 2013-10-17 14:20:07.773667472 +0100
@@ -26,6 +26,7 @@
ALLOWED_HOSTS = []
+ENV_FACTOR_STUFF = os.environENV_FACTOR_STUFF
# Application definition
# (i.e. attempt to get something from the environment)
$ python manage.py validate
Unknown command: 'validate'
Type 'manage.py help' for usage.
$ python manage.py runserver
Unknown command: 'runserver'
Type 'manage.py help' for usage.
etc.
Change History (4)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Component: | Uncategorized → Core (Management commands) |
---|---|
Easy pickings: | set |
Triage Stage: | Unreviewed → Accepted |
That issue is specific to KeyError
, which is swallowed in fetch_command
. But the workaround is trivial (separate get_commands()
from getting the index).
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Does this only happen with
KeyError
, or also with other exceptions? For instance what happens if you put1/0
in your settings file?