Add drf-yasg

* Install drf-yasg

* Add drf-yasg settings and urls

* Pin drf to make drf-yasg work

* Adjust config-models version to be compatible

* Remove django-rest-swagger (the old way)
This commit is contained in:
Ned Batchelder
2019-04-24 15:46:50 -04:00
parent 14f7b90fb8
commit 2e9cae46cb
8 changed files with 43 additions and 11 deletions

View File

@@ -1173,7 +1173,7 @@ INSTALLED_APPS = [
'pipeline_mako',
# API Documentation
'rest_framework_swagger',
'drf_yasg',
'openedx.features.course_duration_limits',
'openedx.features.content_type_gating',

View File

@@ -108,6 +108,10 @@ def should_show_debug_toolbar(request):
DEBUG_TOOLBAR_MONGO_STACKTRACES = False
########################### API DOCS #################################
FEATURES['ENABLE_API_DOCS'] = True
################################ MILESTONES ################################
FEATURES['MILESTONES_APP'] = True

View File

@@ -3,7 +3,7 @@ from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib.admin import autodiscover as django_autodiscover
from django.utils.translation import ugettext_lazy as _
from rest_framework_swagger.views import get_swagger_view
from openedx.core.openapi import schema_view
import contentstore.views
from cms.djangoapps.contentstore.views.organization import OrganizationListView
@@ -266,7 +266,9 @@ urlpatterns += [
if settings.FEATURES.get('ENABLE_API_DOCS'):
urlpatterns += [
url(r'^api-docs/$', get_swagger_view(title='Studio API')),
url(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
url(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
url(r'^api-docs/$', schema_view.with_ui('swagger', cache_timeout=0)),
]
from openedx.core.djangoapps.plugins import constants as plugin_constants, plugin_urls