On 16/08/09 09:38, Maksymus007 wrote:
> On Sun, Aug 16, 2009 at 10:30 AM, adelaide_mike<mike.ro...@internode.on.net> 
> wrote:
>> In my reporting function I need to have:
>>
>> If DATABASE_NAME = x:
>>    #do this
>> Else:
>>    #do the other
>>
>> How can I obtain that name, which is established in settings.py?
>>
>> Mike
> import myproject.settings;
>
> if settings.DATABASE_NAME = x:
>   
Slight clarification required here. Best practice is to use:
> from django.conf import settings
for your import as it will contain the defaults not defined in
myproject.settings, along with other good reasons. See
http://docs.djangoproject.com/en/dev/topics/settings/#using-settings-in-python-code
for more information.

Alex

--~--~---------~--~----~------------~-------~--~----~
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