talkpython / 100daysofweb-with-python-course

Demo code and resources for our 100 Days of Web in Python Course
https://training.talkpython.fm/courses/explore_100days_web/100-days-of-web-in-python
630 stars 391 forks source link

Day 69-72 Django Rest Framework Swagger error #18

Closed Joeriksson closed 5 years ago

Joeriksson commented 5 years ago

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?

bbelderbos commented 5 years ago

Thanks for pointing this out @Joeriksson, I reproduced and fixed it as per above: https://github.com/talkpython/100daysofweb-with-python-course/commit/1aabe58bc29e5453d77dae96e24cb2c2adc2b3f7

alex-vegan commented 5 years ago

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

Joeriksson commented 5 years ago

@alex-vegan glad it helped!