From 3c86cfe7354fe55ba98d35757b5ba0fa59e70d53 Mon Sep 17 00:00:00 2001 From: fengyuanxing Date: Tue, 23 Jan 2018 15:20:17 +0800 Subject: Modify code of requirement and settings Change-Id: I52452ec36358c72e7188ee0bee3ea3d65a504637 Issue-ID: VFC-675 Signed-off-by: fengyuanxing --- catalog/jobs/urls.py | 11 ++++------- catalog/settings.py | 28 +++++++++++++++++++++++++++- catalog/swagger/urls.py | 11 ++++------- requirements.txt | 19 ++++++++++++++++--- 4 files changed, 51 insertions(+), 18 deletions(-) diff --git a/catalog/jobs/urls.py b/catalog/jobs/urls.py index d2e000fd..ea1fcd64 100644 --- a/catalog/jobs/urls.py +++ b/catalog/jobs/urls.py @@ -11,13 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import patterns, url -from rest_framework.urlpatterns import format_suffix_patterns +from django.conf.urls import url from catalog.jobs.views import JobView -urlpatterns = patterns('', - url(r'^api/catalog/v1/jobs/(?P[0-9a-zA-Z_-]+)$', JobView.as_view()), - ) - -urlpatterns = format_suffix_patterns(urlpatterns) +urlpatterns = [ + url(r'^api/catalog/v1/jobs/(?P[0-9a-zA-Z_-]+)$', JobView.as_view()), +] diff --git a/catalog/settings.py b/catalog/settings.py index 3c13adeb..07132361 100644 --- a/catalog/settings.py +++ b/catalog/settings.py @@ -46,7 +46,33 @@ INSTALLED_APPS = [ 'rest_framework', 'catalog.pub.database', 'catalog.samples', - 'catalog.swagger' + 'catalog.swagger', + + 'drf_yasg', +] + +# drf-yasg +SWAGGER_SETTINGS = { + 'LOGIN_URL': '/admin/login', + 'LOGOUT_URL': '/admin/logout', + + 'DEFAULT_INFO': 'catalog.urls.swagger_info' +} + +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', + ], + }, + }, ] MIDDLEWARE_CLASSES = [ diff --git a/catalog/swagger/urls.py b/catalog/swagger/urls.py index a7da03d1..b5e91f07 100644 --- a/catalog/swagger/urls.py +++ b/catalog/swagger/urls.py @@ -12,13 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import patterns, url -from rest_framework.urlpatterns import format_suffix_patterns +from django.conf.urls import url from catalog.swagger.views import SwaggerJsonView -urlpatterns = patterns('', - url(r'^api/catalog/v1/swagger.json$', SwaggerJsonView.as_view()) - ) - -urlpatterns = format_suffix_patterns(urlpatterns) +urlpatterns = [ + url(r'^api/catalog/v1/swagger.json$', SwaggerJsonView.as_view()) +] diff --git a/requirements.txt b/requirements.txt index db0014ec..10ad7a1c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # rest framework -Django==1.9.6 -djangorestframework==3.3.3 +Django==1.11.9 +djangorestframework==3.7.7 # for access MySQL MySQL-python==1.2.5 @@ -23,4 +23,17 @@ unittest_xml_reporting==1.12.0 # for parser cryptography==2.0.3 paramiko==2.0.2 -nfv-toscaparser>=0.5.0 \ No newline at end of file +nfv-toscaparser>=0.5.0 + +# for auto swagger +drf-yasg>=1.2.2 +Pillow>=4.3.0 +pygments>=2.2.0 +django-cors-headers>=2.1.0 +django-filter>=1.1.0,<2.0; python_version == "2.7" +django-filter>=1.1.0; python_version >= "3.4" +djangorestframework-camel-case>=0.2.0 +dj-database-url>=0.4.2 +user_agents>=1.1.0 +flex>=6.11.1 +swagger-spec-validator>=2.1.0 \ No newline at end of file -- cgit 1.2.3-korg