On Sunday, 3 March 2013 17:45:56 UTC+1, Bruno Girin wrote:

> The main stumbling block at the moment and for which we could do with 
> Django expertise is about the structure of the settings files. Some 
> settings are application specific and should be left alone by Juju, others 
> are environment specific and should be generated by Juju (database config 
> for instance). Patrick solved that problem by separating different config 
> elements in different files but this implies that juju'ised applications 
> would need to follow the same structure. Is that a good idea?
>
>
I had a go at something similar a while back [1] (well, a very cut-down 
version of what you guys are attempting), and for that I used configglue's 
in-built support for local settings that override the project settings [2], 
but I'm assuming in this case we'd not want to force juju'ised projects to 
use configglue either.

I've not tried this on any production app, or thought about it more than 
the example below - perhaps others can say the obvious issues they see - 
but one idea that comes to mind is just reversing how people normally split 
up their settings files, something like:

{{{
$ django-admin startproject test_settings
$ cd test_settings/
$ echo 'from django.conf import settings;print("Debug is: %s. LangCode is: 
%s" % (settings.DEBUG, settings.LANGUAGE_CODE))' | ./manage.py shell --plain

(prints "Debug is: True. LangCode is: en-us")

$ echo -e "from test_settings.settings import *\nDEBUG = False" > 
local_settings.py
$ echo 'from django.conf import settings;print("Debug is: %s. LangCode is: 
%s" % (settings.DEBUG, settings.LANGUAGE_CODE))' | ./manage.py shell 
--plain --settings=local_settings

(prints "Debug is: False. LangCode is: en-us")
}}}

-Michael

[1] 
http://micknelson.wordpress.com/2011/11/22/a-generic-juju-charm-for-django-apps/
[2] 
http://bazaar.launchpad.net/~michael.nelson/charms/oneiric/apache-django-wsgi/trunk/view/head:/hooks/manifests/database_settings.pp

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to