I was following the directions at http://django-dajaxice.readthedocs.org/en/latest/installation.html to install Dajaxice for simple AJAX support and I ran into an error I can't quite figure out. The lines:
from dajaxice.core import dajaxice_autodiscover
#dajaxice_autodiscover()
in urls.py seem to be causing an error (cannot import name dajaxice_autodiscover). When I look at the module files for Dajaxice I don't see one for autodiscover either. If I leave out thes开发者_StackOverflow中文版e lines, will I have any troubles using dajaxice? Thanks.
The import should be correct like that! dajaxice_autodiscover
imported in __init.py__
of the core
package, so it is supposed to work like that! More likely the whole app is probably installed in a wrong path, you could try to open a shell (python manage.py shell
) and try import dajaxice
and see what happens!
William What version of dajaxice do you have? the "registration approach" documented in github wiki work with dajaxice>=0.1.5
For older versions of dajaxice you should register your functions in settings.DAJAXICE_FUNCTIONS
.
Anyway newest versions of dajaxice has less bugs.
It looks like the wiki installation instructions are ahead of the available downloads. If you pull the latest version of the code from git and install that then the instructions work. I'm not sure how to install versions 1.4 and below though.
I experienced the same problem and I found the solution. It all about environment vairables in windows. You set following via CMD:
set DJANGO_SETTINGS_MODULE 'Your django project/your site/settings.py
Now it should work fine, Good Luck!
精彩评论