Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#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)

app_settings_jannis.1.diff (1.2 KB ) - added by Jannis Leidel 17 years ago.
App settings, first try

Download all attachments as: .zip

Change History (5)

by Jannis Leidel, 17 years ago

Attachment: app_settings_jannis.1.diff added

App settings, first try

comment:1 by Jannis Leidel, 17 years ago

Owner: changed from nobody to Jannis Leidel

comment:2 by Thomas Güttler, 17 years ago

Resolution: wontfix
Status: newclosed

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 Jannis Leidel, 17 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 Jannis Leidel, 17 years ago

Ah, here is what was discussed during the Pycon sprint: InstalledAppsRevision

Note: See TracTickets for help on using tickets.
Back to Top