Re: settings.py gets imported twice

2007-11-06 Thread Thomas Guettler
Am Dienstag, 6. November 2007 07:00 schrieb Matti Haavikko: > Here's an alternative solution - it's based on the idea that the > handlers are added to the logger only once. (getLogger returns the same > logger instance each time). > > import logging > logger=logging.getLogger("dws") > if not

Re: settings.py gets imported twice

2007-11-05 Thread Matti Haavikko
Thomas Guettler wrote: > A found this solution. > > # file logconfig.py > import logging > if not hasattr(logging, "set_up_done"): > logging.set_up_done=False > > def set_up(myhome): > if logging.set_up_done: > return > logging.set_up_done=True > Here's an alternative

Re: settings.py gets imported twice

2007-11-05 Thread Thomas Guettler
Am Montag, 5. November 2007 10:55 schrieb Malcolm Tredinnick: > On Mon, 2007-11-05 at 10:46 +0100, Thomas Güttler wrote: > > Hi, > > > > settings.py gets imported twice. This is bad, if you want to > > set up the logging module, since you register the handler tw

Re: settings.py gets imported twice

2007-11-05 Thread Malcolm Tredinnick
On Mon, 2007-11-05 at 10:46 +0100, Thomas Güttler wrote: > Hi, > > settings.py gets imported twice. This is bad, if you want to > set up the logging module, since you register the handler twice > and you get all log messages twice. [...] It's actually fairly hard to avoid thi

settings.py gets imported twice

2007-11-05 Thread Thomas Güttler
Hi, settings.py gets imported twice. This is bad, if you want to set up the logging module, since you register the handler twice and you get all log messages twice. Here are the stacktraces I created for debugging this: ===> python manage.py test admin import logconfig Traceback (most rec