1$ pipenv install django-cors-headers
2# or
3$ pip install django-cors-headers
1MIDDLEWARE = [
2 ...
3 'corsheaders.middleware.CorsMiddleware',
4 'django.middleware.common.CommonMiddleware',
5 ...
6]
1CORS_ALLOWED_ORIGINS = [
2 "https://example.com",
3 "https://sub.example.com",
4 "http://localhost:8080",
5 "http://127.0.0.1:9000"
6]