Improve the error message when the implicit settings configuration fails
|Reported by:||ncoghlan||Owned by:||carljm|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently, the fairly generic ImportError message received when the implicit settings configuration fails has a couple of problems:
- it doesn't mention the possibility of using django.conf.settings.configure(). The current error message suggests that an environment variable pointing to a module is the only configuration mechanism Django supports.
- it doesn't mention *which setting* was being looked up when the implicit load failed
These combine to prevent someone that wants to use Django as a library from *incrementally* working out the minimum configuration they need to provide. Instead, they just get told "you need to provide some settings, but we're not going to give you any hints as to what settings are needed for the operations you're trying to use".
Adjusting the way the lazy initialisation is performed would go a long towards making django usable as a library - I could just start importing things, see what settings get accessed, look up those individual settings and provide appropriate values in a django.conf.settings.configure() call. With the current unhelpful error message, I have no idea where to even start.
Change History (4)
comment:1 Changed 2 years ago by lukeplant
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:3 in reply to: ↑ 2 Changed 22 months ago by carljm
- Component changed from Uncategorized to Core (Other)
- Owner changed from nobody to carljm
- Type changed from Uncategorized to Cleanup/optimization