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 38
38
'django.contrib.messages' ,
39
39
'django.contrib.staticfiles' ,
40
40
41
+ 'corsheaders' ,
41
42
'django_crontab' ,
42
43
'rest_framework' ,
43
44
'django_filters' ,
47
48
MIDDLEWARE = [
48
49
'django.middleware.security.SecurityMiddleware' ,
49
50
'django.contrib.sessions.middleware.SessionMiddleware' ,
51
+ 'corsheaders.middleware.CorsMiddleware' ,
50
52
'django.middleware.common.CommonMiddleware' ,
51
53
'django.middleware.csrf.CsrfViewMiddleware' ,
52
54
'django.contrib.auth.middleware.AuthenticationMiddleware' ,
145
147
}
146
148
}
147
149
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
+
148
181
CRONTAB_LOCK_JOBS = True
149
182
150
183
# 静态文件目录
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ constantly==15.1.0
7
7
cryptography == 2.9
8
8
cssselect == 1.1.0
9
9
Django == 2.2.12
10
+ django-cors-headers == 3.2.1
10
11
django-crontab == 0.7.1
11
12
django-filter == 2.2.0
12
13
django-mysql == 3.4.0
You can’t perform that action at this time.
0 commit comments