Access to XMLHttpRequest at 'http://127.0.0.1:8000/XXXXX' from origin 'http://localhost

Django 報錯,跨域請求出現問題。跨域

在settings.py中添加cors

#設置可跨域範圍

CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True
#定義跨域中間件
'corsheaders.middleware.CorsMiddleware',
相關文章
相關標籤/搜索