Move swagger url to swagger dir 43/28843/2
authorying.yunlong <ying.yunlong@zte.com.cn>
Tue, 23 Jan 2018 02:53:38 +0000 (10:53 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Tue, 23 Jan 2018 03:54:08 +0000 (11:54 +0800)
Change-Id: I15b9a3b6ee430f030c8c9d6d2fcc591a233830ea
Issue-ID: VFC-670
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
mgr/mgr/settings.py
mgr/mgr/swagger/urls.py
mgr/mgr/urls.py

index 58cea1f..1845e8e 100644 (file)
@@ -97,7 +97,7 @@ SWAGGER_SETTINGS = {
     'LOGIN_URL': '/admin/login',
     'LOGOUT_URL': '/admin/logout',
 
-    'DEFAULT_INFO': 'mgr.urls.swagger_info'
+    'DEFAULT_INFO': 'mgr.swagger.urls.swagger_info'
 }
 
 DATABASES = {
index b59f61b..6bd93f3 100644 (file)
 # limitations under the License.
 
 from django.conf.urls import url
+from drf_yasg import openapi
+from drf_yasg.views import get_schema_view
+from rest_framework import permissions
+
 from mgr.swagger import views
 
+swagger_info = openapi.Info(
+    title="vnfmgr API",
+    default_version='v1',
+    description="""
+
+The `swagger-ui` view can be found [here](/cached/swagger).
+The `ReDoc` view can be found [here](/cached/redoc).
+The swagger YAML document can be found [here](/cached/swagger.yaml)."""
+)
+
+SchemaView = get_schema_view(
+    validators=['ssv', 'flex'],
+    public=True,
+    permission_classes=(permissions.AllowAny,),
+)
+
 urlpatterns = [
-    url(r'^api/vnfmgr/v1/swagger.json$', views.SwaggerView.as_view())
+    url(r'^api/vnfmgr/v1/swagger.json$', views.SwaggerView.as_view()),
+    url(r'^swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'),
+    url(r'^swagger/$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
+    url(r'^redoc/$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
+    url(r'^cached/swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=None), name='cschema-json'),
+    url(r'^cached/swagger/$', SchemaView.with_ui('swagger', cache_timeout=None), name='cschema-swagger-ui'),
+    url(r'^cached/redoc/$', SchemaView.with_ui('redoc', cache_timeout=None), name='cschema-redoc'),
 ]
index 84112e2..262da0b 100644 (file)
 # limitations under the License.
 
 from django.conf.urls import include, url
-from drf_yasg import openapi
-from drf_yasg.views import get_schema_view
-from rest_framework import permissions
 
 from mgr.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM
 
-swagger_info = openapi.Info(
-    title="vnfmgr API",
-    default_version='v1',
-    description="""
-
-The `swagger-ui` view can be found [here](/cached/swagger).
-The `ReDoc` view can be found [here](/cached/redoc).
-The swagger YAML document can be found [here](/cached/swagger.yaml)."""
-)
-
-SchemaView = get_schema_view(
-    validators=['ssv', 'flex'],
-    public=True,
-    permission_classes=(permissions.AllowAny,),
-)
-
 urlpatterns = [
     url(r'^', include('mgr.samples.urls')),
     url(r'^', include('mgr.vnfreg.urls')),
     url(r'^', include('mgr.swagger.urls')),
-    url(r'^swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'),
-    url(r'^swagger/$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
-    url(r'^redoc/$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
-    url(r'^cached/swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=None), name='cschema-json'),
-    url(r'^cached/swagger/$', SchemaView.with_ui('swagger', cache_timeout=None), name='cschema-swagger-ui'),
-    url(r'^cached/redoc/$', SchemaView.with_ui('redoc', cache_timeout=None), name='cschema-redoc'),
 ]
 
 # regist to MSB when startup