python - Dajaxice function not callable error after initial setup -


i set django , dajaxice , having trouble getting work after closely checking documentation both django set , dajaxice.

after research here @ stack overflow thing found make sure had dajaxice_autodiscover() in urls.py, do. here ajax.py in timeblendapp:

from django.utils import simplejson dajaxice.decorators import dajaxice_register   @dajaxice_register def sayhello(request): return simplejson.dumps({'message':'hello world'}) 

and html page

{% load dajaxice_templatetags %}  <html>   <head>     <script type="text/javascript">         function my_js_callback(data){             alert(data.message);         }     </script>     <title>my base template</title>     {% dajaxice_js_import %}   </head>   <body>   <button onclick="dajaxice.timeblendapp.sayhello(my_js_callback);">click me</button>   </body> </html> 

the error is

functionnotcallableerror @ /dajaxice/timeblendapp.sayhello/ timeblendapp.sayhello request method: request url:    http://127.0.0.1:8000/dajaxice/timeblendapp.sayhello/ django version: 1.5.1 exception type: functionnotcallableerror exception value:     timeblendapp.sayhello exception location: c:\python27\lib\site-packages\dajaxice\views.py in dispatch, line  60 

you must run

python manage.py collectstatic  

everytime change or add dajax/dajaxice functions.so dajaxice can create own javascript libraries in static directory.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -