Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6546 closed (wontfix)

Add option to load settings from installed apps

Reported by: jezdez Owned by: jezdez
Component: Core (Other) Version: master
Severity: Keywords: settings reusable apps
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 jezdez 7 years ago.
App settings, first try

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by jezdez

App settings, first try

comment:1 Changed 7 years ago by jezdez

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to jezdez
  • Patch needs improvement unset

comment:2 Changed 7 years ago by guettli

  • Resolution set to wontfix
  • Status changed from new to 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 Changed 7 years ago by jezdez

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 Changed 7 years ago by jezdez

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

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