summaryrefslogtreecommitdiffstats
path: root/zte/vmanager
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2018-02-05 18:31:21 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2018-02-05 18:31:21 +0800
commit4fa4bf025bd94590915d5678c6f1749f403d9655 (patch)
treeac5238914a404b884c2e658c00d39d6601e94fb5 /zte/vmanager
parent0f4cb066c2fd0b8b611cc54eb94f47489ff10fe9 (diff)
Add vfc-ztevnfmdriver swagger settings
Change-Id: I381c27eeca44e8da78cfee2b9eea0da16a179260 Issue-ID: VFC-736 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'zte/vmanager')
-rw-r--r--zte/vmanager/driver/settings.py43
-rw-r--r--zte/vmanager/driver/swagger/urls.py12
2 files changed, 49 insertions, 6 deletions
diff --git a/zte/vmanager/driver/settings.py b/zte/vmanager/driver/settings.py
index f5923e22..23750ee7 100644
--- a/zte/vmanager/driver/settings.py
+++ b/zte/vmanager/driver/settings.py
@@ -43,7 +43,8 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'rest_framework',
'driver.pub.database',
- 'driver.interfaces'
+ 'driver.interfaces',
+ 'drf_yasg',
]
MIDDLEWARE_CLASSES = [
@@ -87,6 +88,30 @@ DATABASES = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), }}
+# drf-yasg
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+SWAGGER_SETTINGS = {
+ 'LOGIN_URL': '/admin/login',
+ 'LOGOUT_URL': '/admin/logout',
+
+ 'DEFAULT_INFO': 'driver.swagger.urls.swagger_info'
+}
+
TIME_ZONE = 'UTC'
# Static files (CSS, JavaScript, Images)
@@ -99,22 +124,28 @@ LOGGING = {
'disable_existing_loggers': True,
'formatters': {
'standard': {
- 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s', }, },
+ 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s',
+ },
+ },
'filters': {},
'handlers': {
'driver_handler': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
- 'filename': os.path.join(BASE_DIR, 'logs/runtime_driver.log'),
+ 'filename': os.path.join(
+ BASE_DIR,
+ 'logs/runtime_driver.log'),
'formatter': 'standard',
'maxBytes': 1024 * 1024 * 50,
- 'backupCount': 5, }, },
-
+ 'backupCount': 5,
+ },
+ },
'loggers': {
'driver': {
'handlers': ['driver_handler'],
'level': 'DEBUG',
- 'propagate': False}, }}
+ 'propagate': False},
+ }}
if 'test' in sys.argv:
config.REG_TO_MSB_WHEN_START = False
diff --git a/zte/vmanager/driver/swagger/urls.py b/zte/vmanager/driver/swagger/urls.py
index d2ee8110..39c0febc 100644
--- a/zte/vmanager/driver/swagger/urls.py
+++ b/zte/vmanager/driver/swagger/urls.py
@@ -13,8 +13,20 @@
# limitations under the License.
from django.conf.urls import url
+from drf_yasg import openapi
+
from driver.swagger import views
+swagger_info = openapi.Info(
+ title="vfc-vnfmgr API",
+ default_version='v1',
+ description="""
+
+The `swagger-ui` view can be found [here](/swagger).
+The `ReDoc` view can be found [here](/redoc).
+The swagger YAML document can be found [here](/swagger.yaml)."""
+)
+
urlpatterns = [
url(r'^api/ztevnfmdriver/v1/swagger.json$', views.SwaggerView.as_view()),
]