django-cors-headers
$ pipenv install django-cors-headers
# or
$ pip install django-cors-headers
django-cors-headers
$ pipenv install django-cors-headers
# or
$ pip install django-cors-headers
install crossheaders in django
pip install django-cors-headers
#Add corsheaders to installed applications in settings.py:
INSTALLED_APPS = [
...
'corsheaders',
]
#Add corsheaders.middleware.CorsMiddleware to middleware section in settings.py:
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
...
]
#Allow access to all domains by setting the following variable to TRUE in settings.py:
DEBUG = True
ALLOWED_HOSTS = []
CORS_ORIGIN_ALLOW_ALL = True
django-cors-headers
CORS_ALLOWED_ORIGINS = [
"https://example.com",
"https://sub.example.com",
"http://localhost:8080",
"http://127.0.0.1:9000"
]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us