django-cors-headers not work

后端 未结 13 1435
情深已故
情深已故 2020-12-29 04:10

django-cors-headers not work

INSTALLED_APPS = (
    \'django.contrib.admin\',
    \'django.contrib.auth\',
    \'django.contrib.contenttypes\',
    \'django.         


        
13条回答
  •  佛祖请我去吃肉
    2020-12-29 04:26

    Do not forget to add

    'corsheaders.middleware.CorsMiddleware',

    at top of MIDDLEWARE variable :

    See docs :

    CorsMiddleware should be placed as high as possible, especially before any middleware that can generate responses such as Django's CommonMiddleware or Whitenoise's WhiteNoiseMiddleware. If it is not before, it will not be able to add the CORS headers to these responses.

提交回复
热议问题