Python lesson: Section 12 part 19 (Creating APIs) Isn't Working

I made it to this section but every time I follow the instructions for how to make the API and type in “python3 manage.py runserver” to run the webpage, I keep getting this error "ImportError: cannot import name ‘_sanitize_token’ from ‘django.middleware.csrf’ (/Users/alecsmith/.local/share/virtualenvs/vidly-mJrVeZC4/lib/python3.10/site-packages/django/middleware/csrf.py). I have no idea why, I’m following the instructions exactly.

1 Like

I have exactly the same issue and I am also stuck!

Python 3.10.4
Django 4.1.1
django-tastypie 0.14.4

Please help

Hi.

You would have to downgrade to an older version of Django, has to do with Tastypie not been updated in a while to support the latest version of Django

Try: pipenv install django==3.2
and it should work

1 Like