Reputation: 2211
I have my logging configured in settings.py but I want to use it in a cron script. Since I haven't loaded any django stuff yet when the script starts, the logger doesn't work. I can get logging by starting my script with
from django.conf import settings
settings.DEBUG
but is there a better way to make sure the logging has been initialized?
Upvotes: 0
Views: 412
Reputation: 391992
is there a better way to make sure the logging has been initialized?
Yes. Write custom Django commands.
http://docs.djangoproject.com/en/1.3/howto/custom-management-commands
Upvotes: 1