On Friday, March 18, 2011 07:03:25 am hank23 wrote:
> I'm currently working on a new project which will have multiple
> applications built within it, and which will all be using the same
> database. I'd like to setup a global name for each application so I
> can use them to format audit fields for each application whenever
> database updates are taking place as well as whenever exceptions or
> errors are raised. could I then just import the name fields only like
> this:
> 
> from django.conf import settings.APP_NAME1
> 
> or something like that? Thanks for the help.
> 
-- 

Define app specific settings.py files.  So it would be something like


in this settings file you have:

from django.conf import settings

def get(key, default):
        return getattr(settings, key, default)


MYSETTING = get('MYSETTING', True)


import settings as myapp_settings


or from another app.
from myapp import settings as myapp_settings


if myapp_settings.MYSETTING:
   print("Yeah!")


The get function allows others to override your app settings in the global 
projects settings.

Mike


"I once witnessed a long-winded, month-long flamewar over the use of
mice vs. trackballs...It was very silly."
(By Matt Welsh)

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

Reply via email to