Logging warnings inside settings.py

19 views
Skip to first unread message

Jon Dufresne

unread,
Nov 1, 2013, 1:11:05 PM11/1/13
to django...@googlegroups.com
Hi,

I am trying to log warnings inside settings.py. I want to log warnings
when settings (from an outside source) are not provided, but the
application can continue. Is this possible? It seems like this might
not work as logging requires settings.py in order to be configured,
but I want to log earlier than that.

Thanks,
Jon

Arnold Krille

unread,
Nov 3, 2013, 2:02:38 PM11/3/13
to django...@googlegroups.com
On Fri, 1 Nov 2013 10:11:05 -0700 Jon Dufresne <jon.du...@gmail.com>
wrote:
I don't think you want to do that.

If I understand you correctly, you want a warning (or an error) if a
setting is not defined. The correct place to throw that warning is when
you need the setting, not when you define the setting.
Using settings.py for that would be wrong because the setting might be
set afterwards. Most settings.py I encounter or write have a ```try:
import local_settings``` at the bottom...

Have fun,

Arnold
signature.asc
Reply all
Reply to author
Forward
0 new messages