This repository was archived by the owner on May 5, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 3838 'django.contrib.messages' ,
3939 'django.contrib.staticfiles' ,
4040
41+ 'corsheaders' ,
4142 'django_crontab' ,
4243 'rest_framework' ,
4344 'django_filters' ,
4748MIDDLEWARE = [
4849 'django.middleware.security.SecurityMiddleware' ,
4950 'django.contrib.sessions.middleware.SessionMiddleware' ,
51+ 'corsheaders.middleware.CorsMiddleware' ,
5052 'django.middleware.common.CommonMiddleware' ,
5153 'django.middleware.csrf.CsrfViewMiddleware' ,
5254 'django.contrib.auth.middleware.AuthenticationMiddleware' ,
145147 }
146148}
147149
150+ #跨域增加忽略
151+ CORS_ALLOW_CREDENTIALS = True
152+ CORS_ORIGIN_ALLOW_ALL = True
153+ CORS_ORIGIN_WHITELIST = (
154+ '*'
155+ )
156+
157+ CORS_ALLOW_METHODS = (
158+ 'DELETE' ,
159+ 'GET' ,
160+ 'OPTIONS' ,
161+ 'PATCH' ,
162+ 'POST' ,
163+ 'PUT' ,
164+ 'VIEW' ,
165+ )
166+
167+ CORS_ALLOW_HEADERS = (
168+ 'XMLHttpRequest' ,
169+ 'X_FILENAME' ,
170+ 'accept-encoding' ,
171+ 'authorization' ,
172+ 'content-type' ,
173+ 'dnt' ,
174+ 'origin' ,
175+ 'user-agent' ,
176+ 'x-csrftoken' ,
177+ 'x-requested-with' ,
178+ 'Pragma' ,
179+ )
180+
148181CRONTAB_LOCK_JOBS = True
149182
150183# 静态文件目录
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ constantly==15.1.0
77cryptography == 2.9
88cssselect == 1.1.0
99Django == 2.2.12
10+ django-cors-headers == 3.2.1
1011django-crontab == 0.7.1
1112django-filter == 2.2.0
1213django-mysql == 3.4.0
You can’t perform that action at this time.
0 commit comments