Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

renamed package to 'djappsettings', for pypi.

  • Loading branch information...
commit cdd3c68dd9848e7956b99000d0abdcbfce934da3 1 parent 54935e8
Adam Mckaig authored
7 LICENSE
... ... @@ -0,0 +1,7 @@
  1 +Copyright (c) 2010 Adam Mckaig
  2 +
  3 +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  4 +
  5 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  6 +
  7 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
69 README.md
Source Rendered
... ... @@ -1,69 +0,0 @@
1   -Django App Settings
2   -===================
3   -
4   -* I hate pasting blobs into my settings.py every time I enable an app.
5   -
6   -* This is a Python module which provides a sane way for reusable Django apps to configure themselves.
7   -
8   -* 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.
9   -
10   -* 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.
11   -
12   -* App settings are prevented from clobbering [built-in settings](http://code.djangoproject.com/browser/django/trunk/django/conf/global_settings.py). They can only *add* settings.
13   -
14   -* Project settings (in DJANGO_SETTINGS_MODULE) override app settings.
15   -
16   -* Using per-app prefixes is a good idea, but not mandatory.
17   -
18   -
19   -But, but
20   ---------
21   -
22   -* I'm aware of [Jared Forsyth](http://github.com/jabapyth)'s [django-appsettings](http://github.com/jabapyth/django-appsettings), and I think it's lovely but wrong. Project settings should not be editable in the Django admin.
23   -
24   -* I'm also aware that this feature has been rejected numerous times on the Django trac. But pasting a bunch of junk into my settings.py each time I add an app is a pain in the ass.
25   -
26   -* I saw [this snippet](http://www.djangosnippets.org/snippets/573/). It's insufficient.
27   -
28   -* 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.
29   -
30   -
31   -Usage
32   ------
33   -
34   -Where you would usually do something like:
35   -
36   - from django.conf import settings
37   - getattr(settings, "MY_SETTING", "DEFAULT")
38   -
39   -Create a `settings.py` file in your app, containing:
40   -
41   - MY_SETTING = "DEFAULT"
42   -
43   -and do something like:
44   -
45   - from djangoappsettings import settings
46   - settings.MY_SETTING
47   -
48   -If you'd like to support this module where available, but fall back to the usual method if not, just `try` it:
49   -
50   - try: from djangoappsettings import settings
51   - except: from django.conf import settings
52   - settings.MY_SETTING
53   -
54   -
55   -Installation
56   -------------
57   -
58   - $ git clone git://github.com/adammck/django-app-settings.git
59   - $ cd django-app-settings
60   - $ python setup.py install
61   -
62   -
63   -Bugs!
64   ------
65   -
66   -This was created to scratch an itch for the [RapidSMS](http://rapidsms.org) 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.)
67   -
68   -Patches and pull requests are very welcome.
69   -Please file bugs on [GitHub](http://github.com/adammck/django-app-settings/issues).
86 README.rst
Source Rendered
... ... @@ -0,0 +1,86 @@
  1 +DjAppSettings: Per-App Settings for Django
  2 +==========================================
  3 +
  4 +* I hate pasting blobs into my settings.py every time I enable an app.
  5 +
  6 +* This is a Python module which provides a sane way for reusable Django apps to configure themselves.
  7 +
  8 +* 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.
  9 +
  10 +* 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.
  11 +
  12 +* App settings are prevented from clobbering `built-in settings`_. They can only *add* settings.
  13 +
  14 +* Project settings (in ``DJANGO_SETTINGS_MODULE``) override app settings.
  15 +
  16 +* Using per-app prefixes is a good idea, but not mandatory.
  17 +
  18 +.. _built-in settings: http://code.djangoproject.com/browser/django/trunk/django/conf/global_settings.py
  19 +
  20 +
  21 +But, but
  22 +--------
  23 +
  24 +* 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.
  25 +
  26 +* I'm also aware that this feature has been rejected numerous times on the Django trac. But pasting a bunch of junk into my ``settings.py`` each time I add an app is a pain in the ass.
  27 +
  28 +* 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.
  29 +
  30 +.. _Jared Forsyth: http://github.com/jabapyth
  31 +.. _django-appsettings: http://github.com/jabapyth/django-appsettings
  32 +
  33 +
  34 +Usage
  35 +=====
  36 +
  37 +Where you would usually do something like::
  38 +
  39 + from django.conf import settings
  40 + getattr(settings, "MY_SETTING", "DEFAULT")
  41 +
  42 +Create a ``settings.py`` file in your app, containing::
  43 +
  44 + MY_SETTING = "DEFAULT"
  45 +
  46 +and do something like::
  47 +
  48 + from djappsettings import settings
  49 + settings.MY_SETTING
  50 +
  51 +If you'd like to support this module where available, but fall back to the usual method if not, just ``try`` it::
  52 +
  53 + try: from djappsettings import settings
  54 + except: from django.conf import settings
  55 + settings.MY_SETTING
  56 +
  57 +
  58 +Installation
  59 +============
  60 +
  61 +Via Pip::
  62 +
  63 + $ pip install djappsettings
  64 +
  65 +Via GitHub::
  66 +
  67 + $ git clone git://github.com/adammck/djappsettings.git
  68 + $ python djangoappsettings/setup.py install
  69 +
  70 +
  71 +Bugs?
  72 +=====
  73 +
  74 +This was created to scratch an itch for the `RapidSMS`_ project. I hope it will be useful to you, 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.)
  75 +
  76 +Patches and pull requests are very welcome.
  77 +Please file bugs on `GitHub`_.
  78 +
  79 +.. _RapidSMS: http://rapidsms.org
  80 +.. _GitHub: http://github.com/adammck/djappsettings/issues
  81 +
  82 +
  83 +License
  84 +=======
  85 +
  86 +djappsettings is free software, available under the BSD license.
5 djangoappsettings/__init__.py
... ... @@ -1,5 +0,0 @@
1   -#!/usr/bin/env python
2   -# vim: et ts=4 sw=4
3   -
4   -from .settings import DjangoAppSettings
5   -settings = DjangoAppSettings()
5 lib/djappsettings/__init__.py
... ... @@ -0,0 +1,5 @@
  1 +#!/usr/bin/env python
  2 +# vim: et ts=4 sw=4
  3 +
  4 +from .settings import DjAppSettings
  5 +settings = DjAppSettings()
2  djangoappsettings/settings.py → lib/djappsettings/settings.py
@@ -8,7 +8,7 @@
8 8 from django.utils import importlib
9 9
10 10
11   -class DjangoAppSettings(object):
  11 +class DjAppSettings(object):
12 12 def __init__(self):
13 13 self._modules = None
14 14
12 setup.py
@@ -2,17 +2,17 @@
2 2 # vim: et ts=4 sw=4
3 3
4 4
5   -from distutils.core import setup
  5 +from setuptools import setup
6 6
7 7
8 8 setup(
9   - name="django-app-settings",
  9 + name="djappsettings",
10 10 version="0.1.0",
11   - license="CC0",
  11 + license="BSD",
12 12
13 13 author="Adam Mckaig",
14 14 author_email="adam.mckaig@gmail.com",
15 15
16   - description="Allow Django apps to provide default settings",
17   - url="http://github.com/adammck/django-app-settings",
18   - packages=["djangoappsettings"])
  16 + description="Per-app default settings for Django",
  17 + url="http://github.com/adammck/djappsettings",
  18 + packages=["lib/djappsettings"])

0 comments on commit cdd3c68

Please sign in to comment.
Something went wrong with that request. Please try again.