[Answer]-Dajax installation

1👍

Bit late – but I don’t see any obvious mistakes. Perhaps you could first to try to get some information on the problem. Does your settings.py have:

DEBUG = True 

you might want to add some loggers to settings.py – e.g:

'dajaxice': {
   'handlers': ['file', 'console'],
   'level': 'WARNING',
   'propagate': True,
   },
'dajaxice.DajaxiceRequest': {
   'handlers': ['file', 'console'],
   'level': 'WARNING',
   'propagate': True,
   },
}

you also don’t state whether or not your ajax.py has imported the required modules, might be worth checking:

from dajax.core import Dajax
from dajaxice.decorators import dajaxice_register

and from the docs dajax requires jQuery 1.6.2 (and above from my experience). What version are you using?

finally – make sure you add the registration decorator to your ajax.py functions, or otherwise register them as per the documentation http://docs.dajaxproject.com/dajaxice/create-my-first-dajaxice-function.html#create-your-ajax-function

For example:

@dajaxice_register
def myexample(request):
    return simplejson.dumps({'message': 'Hello World'})

I’m loving Dajax/Dajaxice, although it’s allowing me (or I’m allowing myself) to get into a big of a spaghetti bowl of code looping back and forth between python/django & js.

Leave a comment