SWAGGER_SETTINGS = {
'exclude_namespaces': [],
'api_version': '0.1',
'api_path': '/docs',
'enabled_methods': [
'get',
'post',
'put',
'patch',
'delete'
],
'api_key': '',
'is_authenticated': False,
'is_superuser': False,
'permission_denied_handler': None,
'base_path': 'localhost/',
'info': {
'contact': 'apiteam@wordnik.com',
'description': 'This is a sample server Petstore server. '
'You can find out more about Swagger at '
''
'http://swagger.wordnik.com '
'or on irc.freenode.net, #swagger. '
'For this sample, you can use the api key '
'"special-key" to test '
'the authorization filters',
'license': 'Apache 2.0',
'licenseUrl': 'http://www.apache.org/licenses/LICENSE-2.0.html',
'termsOfServiceUrl': 'http://helloreverb.com/terms/',
'title': 'Swagger Sample App',
},
'doc_expansion': 'none',
}
I have integrated
django-rest-swagger
to mydjango restframework API app
. But gettingaccess-control-origin
error.Settings:
MIDDLEWARE_CLASSES = ( 'corsheaders.middleware.CorsMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'subdomains.middleware.SubdomainURLRoutingMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', )
SWAGGER_SETTINGS = { 'exclude_namespaces': [], 'api_version': '0.1', 'api_path': '/docs', 'enabled_methods': [ 'get', 'post', 'put', 'patch', 'delete' ], 'api_key': '', 'is_authenticated': False, 'is_superuser': False, 'permission_denied_handler': None, 'base_path': 'localhost/', 'info': { 'contact': 'apiteam@wordnik.com', 'description': 'This is a sample server Petstore server. ' 'You can find out more about Swagger at ' '' 'http://swagger.wordnik.com ' 'or on irc.freenode.net, #swagger. ' 'For this sample, you can use the api key ' '"special-key" to test ' 'the authorization filters', 'license': 'Apache 2.0', 'licenseUrl': 'http://www.apache.org/licenses/LICENSE-2.0.html', 'termsOfServiceUrl': 'http://helloreverb.com/terms/', 'title': 'Swagger Sample App', }, 'doc_expansion': 'none', }