4

When am trying to run the chron job in django using below command

python manage.py runcrons

its showing one error like below

$ python manage.py runcrons
No handlers could be found for logger "django_cron"

Does any one have any idea about this error? Any help is appreciated.

mariodev
  • 13,469
  • 3
  • 48
  • 60
Akshath Kumar
  • 479
  • 2
  • 5
  • 15

2 Answers2

3

It is kind of given in the error you get. You are missing a handler for the "django_cron" logger. See for example https://stackoverflow.com/a/7048543/1197616. Also have a look at the docs for Django, https://docs.djangoproject.com/en/dev/topics/logging/.

Community
  • 1
  • 1
mattias
  • 2,031
  • 3
  • 21
  • 27
  • 1
    Thanks a lot. I got the solution for this. – Akshath Kumar Feb 28 '15 at 10:54
  • @AkshathKumar could you please help me i got the same error. I couldnt find out the answer from the comment – Thameem Mar 12 '15 at 12:51
  • 1
    @Thameem .. You have to add handlers in settings.py.Here is my code - LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'file': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'filename': '/home/hduser/Desktop/debug.log', #/pyenv/venv/lib/python2.7/site-packages/django/ }, }, 'loggers': { 'django_cron': { 'handlers': ['file'], 'level': 'DEBUG', 'propagate': True, }, }, } – Akshath Kumar Mar 12 '15 at 14:57
0

Actually the django-cron library does not require a 'django_cron' logger. I resolved the same problem by running the migrations of django_cron:

python manage.py migrate #migrate database
Wira
  • 503
  • 5
  • 12
renzop
  • 1,086
  • 1
  • 11
  • 22