1👍
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.
Also if you are using CORS_REPLACE_HTTPS_REFERER it should be placed before Django’s CsrfViewMiddleware
0👍
you can try that command
pip install django-cors-headers
i use Django version:Django==2.1.7 ,python version:Python==3.6,
first i try pip3 install django-cors-headers
,
the module name corsheaders
could not found,
then i try
pip install django-cors-headers
it worked
that may help you
consider about version of pip
0👍
Just install from pip
python -m pip install django-cors-headers
And then add it to your installed apps:
INSTALLED_APPS = [
...
'corsheaders',
...
]
Hopefully, it will work. If not working then restart your server and run again.
- Child object by Parent
- Error in viewing extended DetailView in Django
- POST json array and get response as json array