2

I know, I know, the first thing you are thinking is to check all of the instructions online and on dajaxproject.com

Well I have checked and checked and rerun this installation and I cannot figure out what the problem is. I assume it has something to do with the version of Dajaxice I am using and the version the installation instructions are, but those details are usually missing.

At this point in the process, I have everything setup to accomplish a very simple task. Load a webpage from the IP:8000 (ie 1.2.3.4:8000) and have that page load a simple html form button. Once that button is pressed, the page should then send a mesage (using dajaxice) to the server, and once it returns an alert box will pop up, proving that the dajaxice install is working.

So, I have:

  • Installed Dajaxice (and dajax for that matter), by getting the zip from here: github [dot] com/jorgebastida/django-dajaxice/
  • Changed everything in a basic Django project to follow the details in this tutorial: http://django-dajaxice.readthedocs.org/en/latest/installation.html
  • I have setup all of the details of ajax.py, and index.html to work with this example: django-dajaxice [dot] readthedocs [dot] org/en/latest/quickstart.html

PS Sorry for the "[dot]"s, but being a new registered user they limit you to 2 per post, so I tried to give you the best links clickable.

I am stumped. I have been trying many different things, but the documentation available seems so sporadic. It's gotta be something simple I am messing up, but I cannot seem to find it.

Currently, the "Say Hello!" button shows up on the screen, but nothing happens when you press it. Any ideas?

Here is a link to the zip file of the Django project I am working with here: https://docs.google.com/open?id=0B5rzYk6W5HlrYk9veVRfM3JkTGc

The way I have it all organized, DjangoAjax is just the folder containing the Django project. ajax_prac is the project, and practice is an app. Also you'll see a folder called django_media...that's pretty self explanatory, it just holds all the "media" for my Django projects, including jquery.js and jquery.dajax.core.js

If there are some details that I have smudged in the code, contrary to the installation guide, I apologize. I have been working through so many iterations of this, that it is likely I could've forgotten to change something back when making this post.

Can anyone help?

John Zeller
  • 555
  • 2
  • 7
  • 19

2 Answers2

4

All the documentation weirdness is probably related with the new release I made yesterday (8 hours ago). Probably you was using an old version of dajaxice reading the new documentation.

I've release django-dajaxice (0.5) and django-dajax (0.9.1), both fully compatible with the last version of Django (1.4.1).

django-dajaxice: http://pypi.python.org/pypi/django-dajaxice django-dajax: http://pypi.python.org/pypi/django-dajax

For this release I've also rewrite both documentations and hosted them on readthedocs. Also, http://dajaxproject.com code is now opensource so everybody can read the code and see how dajaxice works in production.

django-dajaxice: http://django-dajaxice.readthedocs.org/en/latest/ django-dajax: http://django-dajax.readthedocs.org/en/latest/ example project: https://github.com/jorgebastida/dajaxproject.com

Could you please upgrade to django-dajaxice (0.5) follow the new installation steps (quite similar http://django-dajaxice.readthedocs.org/en/latest/installation.html) and post here any traceback/issue you could have?

Thanks

Jorge Bastida
  • 535
  • 5
  • 10
  • Excellent thanks very much! So I have installed everything you asked. And it's still not running. There is no Traceback error. The page loads index.html with a simple button that should use dajax to render an alert box with the message "Hello World!", yet it does not. My files still look the same as the ones here: https://docs.google.com/open?id=0B5rzYk6W5HlrYk9veVRfM3JkTGc Any ideas? – John Zeller Aug 16 '12 at 22:53
0

In your example code ( DjangoAjax / ajax_prac / templatedirectory / practice / index.html):

<input type="button" value="Send message to server!"
onclick="Dajaxice.ajax.sayhello(my_js_callback);">

Should be:

<input type="button" value="Send message to server!"
onclick="Dajaxice.ajax_prac.practice.views.sayhello(my_js_callback);">

I.e. It must reference a Python module that contains your registered Dajaxice view. And according to your sample code, ajax_prac.practice.views exists while ajax.sayhello does not.

Also the Python module must be prefaced with "Dajaxice" (which is probably a significant source of confusion).

aclark
  • 4,345
  • 1
  • 17
  • 31