Django CORS on static asset

放肆的年华 提交于 2020-08-25 04:42:08

问题


I'm using Django as a backend, and have run into cross origin issues which I had fixed using the corsheaders package in settings. So far, all my GET endpoints work, thanks to:

CORS_ORIGIN_ALLOW_ALL = True

However, I'm now trying to access a static file on the django backend, located as such:

http://localhost:8000/static/image.jpg

The browser client however gets the familiar error as before:

Access to XMLHttpRequest at ... from origin ... has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Any ideas? Thanks

来源:https://stackoverflow.com/questions/55751033/django-cors-on-static-asset

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!