#6546 closed (wontfix)
Add option to load settings from installed apps
| Reported by: | Jannis Leidel | Owned by: | Jannis Leidel |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | Keywords: | settings reusable apps | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
It might be useful for reusable apps to automatically load settings from installed apps.
The attached patch enables app authors to put a settings.py file in their app distributions.
These app settings are automatically loaded (except if there is already a setting with the same name) and can be overridden by project settings.
Attachments (1)
Change History (5)
by , 18 years ago
| Attachment: | app_settings_jannis.1.diff added |
|---|
comment:1 by , 18 years ago
| Owner: | changed from to |
|---|
comment:2 by , 18 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
Sorry, but I think this is a bad idea. For what kind of settings do you want to
use this application specific settings file?
It would be better to have a common place to store application specific settings somewhere
else.
I store them in settings.APPNAME. Example: settings.APPNAME.default_color='green'.
The app specific settings get loaded like this:
# settings.py import APPNAME
comment:3 by , 18 years ago
Yeah, this is what I use in my Django "projects" to have local settings, pretty basic of course:
try:
from local_settings import *
except ImportError:
pass
I figured it might be good to have app-based settings as defaults that can be overridden by other users if required and wrote this snippet: http://www.djangosnippets.org/snippets/573/ Which is ugly.
But since the INSTALLED_APPS and app loading mechanism is redesigned anyway, the new App objects might be the right place for having these default settings. What do you think?
comment:4 by , 18 years ago
Ah, here is what was discussed during the Pycon sprint: InstalledAppsRevision
App settings, first try