summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2018-01-23 10:53:38 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2018-01-23 11:54:08 +0800
commite6afb9a8a792bdab4055413540a586d92eb6c924 (patch)
tree8389511c2f691926f69273342468649f5018a4f1
parentac8f3283863de4f7137c6919d5815e3ec045aea1 (diff)
Move swagger url to swagger dir
Change-Id: I15b9a3b6ee430f030c8c9d6d2fcc591a233830ea Issue-ID: VFC-670 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--mgr/mgr/settings.py2
-rw-r--r--mgr/mgr/swagger/urls.py28
-rw-r--r--mgr/mgr/urls.py25
3 files changed, 28 insertions, 27 deletions
diff --git a/mgr/mgr/settings.py b/mgr/mgr/settings.py
index 58cea1f..1845e8e 100644
--- a/mgr/mgr/settings.py
+++ b/mgr/mgr/settings.py
@@ -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 = {
diff --git a/mgr/mgr/swagger/urls.py b/mgr/mgr/swagger/urls.py
index b59f61b..6bd93f3 100644
--- a/mgr/mgr/swagger/urls.py
+++ b/mgr/mgr/swagger/urls.py
@@ -13,8 +13,34 @@
# 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'),
]
diff --git a/mgr/mgr/urls.py b/mgr/mgr/urls.py
index 84112e2..262da0b 100644
--- a/mgr/mgr/urls.py
+++ b/mgr/mgr/urls.py
@@ -13,38 +13,13 @@
# 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