marcgibbons / django-rest-swagger

Swagger Documentation Generator for Django REST Framework: deprecated
https://marcgibbons.com/django-rest-swagger/
BSD 2-Clause "Simplified" License
2.59k stars 599 forks source link

getting access-control-origin error #300

Closed vaibhav-jain closed 9 years ago

vaibhav-jain commented 9 years ago

I have integrated django-rest-swagger to my django restframework API app. But getting access-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', }

vaibhav-jain commented 9 years ago

As soon as i removed the settings the error disappeared.