# 参考:
https://blog.csdn.net/linzi1994/article/details/82724429
https://www.cnblogs.com/ShaunChen/p/5998800.html# 配置详解:
# 跨域设置
CORS_ORIGIN_ALLOW_ALL = True # 允许所有域名
CORS_ALLOW_CREDENTIALS = True # 允许获取cookie
CORS_URLS_REGEX = r'^.*$'CORS_ORIGIN_WHITELIST = ('*'
)
#
# CORS_ORIGIN_ALLOW_ALL = False
# CORS_ORIGIN_WHITELIST = (
# 'localhost:63343',
# )
#
# # 默认值是全部:
# CORS_ORIGIN_WHITELIST = () # 或者定义允许的匹配路径正则表达式.
# CORS_ORIGIN_REGEX_WHITELIST = ('^(https?://)?(\w+.)?>google.com$', ) # 默认值:
# CORS_ORIGIN_REGEX_WHITELIST = ()CORS_ALLOW_METHODS = ('DELETE','GET','OPTIONS','PATCH','POST','PUT','VIEW',
)CORS_ALLOW_HEADERS = ('XMLHttpRequest','X_FILENAME','accept-encoding','authorization','content-type','dnt','origin','user-agent','x-csrftoken','x-requested-with','Pragma',
)
转载于:https://www.cnblogs.com/lajiao/p/9754584.html