Skip to content

Commit

Permalink
Configure django-rest-swagger
Browse files Browse the repository at this point in the history
After launching django server, it became possible to access
swagger generated documentation at '/docs' url.

Related-Issue: #14
  • Loading branch information
travelist committed Apr 15, 2015
1 parent 7cdb98f commit 3bb0c01
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
30 changes: 28 additions & 2 deletions cognitive/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@

TEMPLATE_LOADERS = (
'hamlpy.template.loaders.HamlPyFilesystemLoader',
'hamlpy.template.loaders.HamlPyAppDirectoriesLoader'
'hamlpy.template.loaders.HamlPyAppDirectoriesLoader',
'django.template.loaders.eggs.Loader',
)

ALLOWED_HOSTS = []
Expand All @@ -58,6 +59,7 @@
# 'djangobower',
'rest_framework',
'cognitive.MLApp',
'rest_framework_swagger',
)

MIDDLEWARE_CLASSES = (
Expand Down Expand Up @@ -107,7 +109,6 @@
REDIS_HOST = "bd-1-3"
REDIS_PORT = "6379"


# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'

Expand Down Expand Up @@ -136,3 +137,28 @@ def get_staticfiles_dirs(webroot='/'):

STATICFILES_DIRS = get_staticfiles_dirs()
STATICFILES_DIRS.append((os.path.join(BASE_DIR + '/cognitive/MLApp', "static")))


# Swagger Documentation Setting
SWAGGER_SETTINGS = {
'exclude_namespaces': [],
'api_version': '1.0',
'api_path': '/',
'enabled_methods': [
'get',
'post',
'put',
'delete'
],
'api_key': '',
'is_authenticated': False,
'is_superuser': False,
'permission_denied_handler': None,
'info': {
'description': 'Cognitive API Documentation',
'license': 'Apache 2.0',
'licenseUrl': 'http://www.apache.org/licenses/LICENSE-2.0.html',
'title': 'Cognitive - Machine Learning as a Service (MLaaS)',
},
'doc_expansion': 'none',
}
1 change: 1 addition & 0 deletions cognitive/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
url(r'^$', views.index, name="home"),
url(r'^whiteboard$', views.whiteboard, name="whiteboard"),
url(r'^api/v1/', include(urls)),
url(r'^docs/', include('rest_framework_swagger.urls')),
)

0 comments on commit 3bb0c01

Please sign in to comment.