Using djangorecipe and zc.buildout offer your exactly that kind of mechanism.

You write the name of settings of choice in your buildout:

[django]
recipe = djangorecipe
version = 1.1
settings = development
eggs = ${eggs:eggs}
wsgi = true
project = project

And after that you can have by example another production's
configuration file like "prod.cfg" overloading your django part and
using another settings name.

In your project dir, you'll have a file named development.py and
another one named prod.py. In these files you can override any
configuration you want.

For deployement, zc.buildout is working pretty fine with django:

http://pypi.python.org/pypi/djangorecipe


On Wed, Jan 20, 2010 at 1:46 AM, mrts <mrts.py...@gmail.com> wrote:
> On Jan 20, 5:59 am, David Cramer <dcra...@gmail.com> wrote:
>> The first three have been huges ones with us. We're just now running
>> into the settings issue, but would love to see what people can come up
>> with for solutions (we dont have a good one).
>
> The override_settings() idea that Eric Florenzano describes at
> http://djangodose.com/articles/2009/09/handling-development-staging-and-production-enviro/
> with some improvements and fixes as described in the following
> http://djangodose.com/articles/2009/09/handling-development-staging-and-production-enviro/#comment-16302200
> have made my life considerably easier.
>
> Hope the following helps others as well.
>
> # 1.
> # settings is a directory, containing host-specific overrides
> # and the generic override logic
>
> $ ls settings/
> __init__.py   override.py   host1.py   host2.py
>
> # 2.
> # __init__.py has the same contents that settings.py
> # usually has, except it automatically imports host-specific
> # settings in the end
>
> $ tail -2 settings/__init__.py
> override.override_settings('projectname', platform.node().split('.')
> [0],
>        sys.modules[__name__])
>
> # 3.
> # The generic override logic is as follows
>
> $ cat settings/override.py
> from django.utils.importlib import import_module
> import warnings
>
> def override_settings(package, name, settings_module):
>    rel_path = 'settings.' + name
>    try:
>        override_module = import_module(rel_path, package=package)
>    except ImportError:
>        warnings.warn("Failed to import settings from '%s.%s'" %
>                (package, rel_path))
>    else:
>        for key in dir(override_module):
>            if key.isupper() and not key.startswith('__'):
>                setattr(settings_module, key, getattr(override_module,
> key))
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-developers?hl=en.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.


Reply via email to