[Answer]-No handler could be found for logger "dajaxice"

1👍

My guess is that this is a django error which is passed via ajax to the browser console. Have a look at django-dajaxice/dajaxice/core/Dajaxice.py where Dajaxice defines its own error logger log = logging.getLogger('dajaxice') at the top. So what you need to do is to adapt your projects settings.py and define this logger with an existing handler e.g.:

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
    'require_debug_false': {
        '()': 'django.utils.log.RequireDebugFalse'
    },
    'require_debug_true': {
        '()': 'django.utils.log.RequireDebugTrue'
    },
},
'handlers': {
    'mail_admins': {
        'level': 'ERROR',
        'filters': ['require_debug_false'],
        'class': 'django.utils.log.AdminEmailHandler'
    },
    'debug_console': {
        'level': 'DEBUG',
        'filters': ['require_debug_true'],
        'class': 'logging.StreamHandler'
    },
},
'loggers': {
    'django.request': {
        'handlers': ['mail_admins'],
        'level': 'ERROR',
        'propagate': True,
    },
    'dajaxice': {
    'handlers': ['debug_console'],
    'level': 'WARNING',
    'propagate': False,
    },
}
}

Note that this example needs Django >=1.5 because of the django.utils.log.RequireDebugTrue.

This will of course not solve your porblem but at least you get to the real error message.
For detailed informatin about Django logging please read the official docs.

The real django error comes from the fact that @dajaxice_register is a method decorator that has to be put in front of every method you want to use in dajax. Change your ajax.py to:

from django.utils import simplejson
from contacts.models import Notifications
from dajaxice.decorators import dajaxice_register

@dajaxice_register 
def args_example(request):
    return simplejson.dumps({'message':'Message is '})

@dajaxice_register 
def change(request):
    return simplejson.dumps({'message':'Message is '})
👤frixx

Leave a comment