Opened 3 years ago
Last modified 3 years ago
#33162 closed New feature
AttributeError: 'Settings' object has no attribute '__file__' — at Version 2
Reported by: | Thomas Güttler | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Sometimes you have no clue which settings file is active.
For other files I use this pattern, to see which actual file is loaded:
assert 0, mylib.__file__
Unfortunately this does not work for django.conf.settings
:
AttributeError: 'Settings' object has no attribute '__file__'
It would be super cool, if this attribute would be available.
Of course I could use:
assert 0, os.environ['DJANGO_SETTINGS_MODULE']
But sometimes the env var is not the actual file.
Change History (2)
comment:1 by , 3 years ago
Description: | modified (diff) |
---|
comment:2 by , 3 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.