pip install django-cors-headers

settings.py中
install_app = ['corsheader']
# cors
CORS_ORIGIN_WHITELIST = (
'http://127.0.0.1:8000',
'http://127.0.0.1:8888',
'http://localhost:8000',
'http://localhost:8888',
)

CORS_ALLOW_CREDENTIALS = True # allow cookie