Access to XMLHttpRequest at 'http://127.0.0.1:8081/api/login/' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
pip install django-cors-headers
'corsheaders',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
至此Access-Control-Allow-Origin問題排除