Enable swagger API documentation in Django Rest framework 3.x with Troubleshooting

Опубликовано: 06 Октябрь 2024
на канале: Ajith S
638
8

In video, we will enable swagger API documentation in DRF 3.0 with few hacks.

Steps:
--------
1) Go to, https://django-rest-swagger.readthedo... and follow the steps. Instead of views.py in document, paste the code in main project urls.py.

2) In settings.py,add
REST_FRAMEWORK = { 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema' }
3) Go to below file
venv\Lib\site-packages\rest_framework_swagger\templates\rest_framework_swagger\index.html
change line 2 as {% load static %}

Reference:
https://stackoverflow.com/questions/5...