Last active
September 10, 2018 13:49
-
-
Save fronzec/9098d57e3f1b36aeabd5c4927eafa90f to your computer and use it in GitHub Desktop.
Custom cors Middleware Django
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding:utf-8 -*- | |
| # Put this file under <your_app>/middleware/cors.py | |
| # Edit your setting.py | |
| from django.http import HttpResponse | |
| from django.utils.deprecation import MiddlewareMixin | |
| class CorsMiddleware(MiddlewareMixin): | |
| def process_response(self, request, response): | |
| response["Acces-Control-Allow-Origin"] = "*" | |
| return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment