https://github.com/adamchainz/django-cors-headers
:::tips python3 -m pip install django-cors-headers :::
INSTALLED_APP = [...'corsheaders',...]MIDDLEWARE = ['corsheaders.middleware.CorsMiddleware',...]CORS_ORIGIN_WHITELIST = ('http://127.0.0.1:8081',)
:::tips 注意:在MIDDLEWARE的配置中,要将Cors的中间件插入到最前面 :::
也可以使用下面的配置来允许所有调用者使用
CORS_ORIGIN_ALLOW_ALL = True
