Django settings.py under cross-domain configuration

In settings.py   

Insert the following code MIDDLEWARE
 Note on the second line,
  'corsheaders.middleware.CorsMiddleware',
  'django.middleware.common.CommonMiddleware',

 

Joining Configuration

 

# 4, the configuration parameters django-cors-headers in 
CORS_ALLOW_CREDENTIALS = True 
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_METHODS = (
    'DELETE',
    'GET',
    'OPTIONS',
    'PATCH',
    'POST',
    'PUT',
    'VIEW',
)
CORS_ALLOW_HEADERS = (
'XMLHttpRequest',
'X_FILENAME',
'accept-encoding',
'authorization',
'content-type',
'dnt',
'origin',
'user-agent',
'x-csrftoken',
'x-requested-with',
'Pragma',
)


 

Guess you like

Origin www.cnblogs.com/junjun511/p/11093869.html