[Django]-ImportError: cannot import name 'ajax'

3👍

You’ve apparently installed the wrong package due to name similarity with another package. That usually happens.

You’ve installed django_ajax 0.2.0 while you intend to use djangoajax which has the ajax decorator. The former does not have or use decorators.

Remove django_ajax with:

pip uninstall django_ajax

Then install djangoajax which is usually imported as django_ajax and would be added as django_ajax to INSTALLED_APPS:

pip install djangoajax

Your import would no longer raise an error:

>>> from django_ajax.decorators import ajax
>>>

Leave a comment