github 上有详细介绍:https://github.com/ottoyiu/django-cors-headers
1、pip install django-cors-headers # 下载
2、添加进apps
INSTALLED_APPS = [
...
'corsheaders',
...
]
3、 配置 尽量放在csrf之前
MIDDLEWARE = [ # Or MIDDLEWARE_CLASSES on Django < 1.10
...
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
...
]
4、 再
CORS_ORIGIN_ALLOW_ALL = True
博客介绍了django-cors-headers在github上的详细介绍链接,还提及了其配置步骤,包括下载、添加进apps,且配置时尽量放在csrf之前。
518

被折叠的 条评论
为什么被折叠?



