talkpython/100daysofweb-with-python-course

Day 69-72 Django Rest Framework Swagger error

Closed this issue · 3 comments

After coding along the videos in this section of the course. I get a

'AutoSchema' object has no attribute 'get_link' error when going to api/docs.

It turns out you need to put the following into settings.py to get it to work

REST_FRAMEWORK = {
  'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema'
}

Reference: https://www.django-rest-framework.org/community/3.10-announcement/#continuing-to-use-coreapi

It's probably because I am using a newer version of django-rest-framework than is used in the videos?

Thanks for pointing this out @Joeriksson, I reproduced and fixed it as per above: 1aabe58

@Joeriksson, thanks for that. You've saved my time and nerves for find release of this issue.

@alex-vegan glad it helped!