Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Per-app default settings for Django
tree: 588b5c02ea

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Django App Settings

  • I hate pasting blobs into my every time I enable an app.

  • This is a Python module which provides a sane way for reusable Django apps to configure themselves.

  • It's a drop-in replacement for the django.conf.settings class. You can fetch all of your project, app, and global default settings via a single settings object.

  • It doesn't touch your project's settings module, and existing Django apps are free to ignore it. Your app can even fall back to the usual method if this module isn't available.

  • App settings are prevented from clobbering built-in settings. They can only add settings.

  • Project settings (in DJANGO_SETTINGS_MODULE) override app settings.

  • Using per-app prefixes is a good idea, but not mandatory.

But, but

  • I'm aware of Jared Forsyth's django-appsettings, and I think it's lovely but wrong. Project settings should not be editable in the Django admin.

  • I'm also aware that this feature has been rejected numerous times on the Django trac. But pasting a bunch of junk into my each time I add an app is a pain in the ass.

  • I saw this snippet. It's insufficient.

  • Checking for a setting (via settings.hasattr), and falling back to a hard-coded default value is a terrible solution, because your defaults are duplicated and buried. They should be easily discoverable.


Where you would usually do something like:

from django.conf import settings
getattr(settings, "MY_SETTING", "DEFAULT")

Create a file in your app, containing:


and do something like:

from djangoappsettings import settings

If you'd like to support this module where available, but fall back to the usual method if not, just try it:

try: from djangoappsettings import settings
except: from django.conf import settings


$ git clone git://
$ cd django-app-settings
$ python install


This was created to scratch an itch for the RapidSMS project. I hope it will be useful to others, but it doesn't have any docs or tests yet, and hasn't been field tested. There are almost certainly bugs. Use it at your own risk. (But do use it, because it's way better.)

Patches and pull requests are very welcome. Please file bugs on GitHub.

[1] [2] [3] [4] [5] [6]

Something went wrong with that request. Please try again.