This repository was archived by the owner on Nov 11, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
2
import os
3
3
from pathlib import Path
4
- import rest_framework
5
4
6
5
CONFIGURATION = json .load (open ((Path (__file__ ).parent / '../config.json' ).resolve ()))
7
6
13
12
# SECURITY WARNING: don't run with debug turned on in production!
14
13
DEBUG = CONFIGURATION ['DEBUG' ] # int(os.environ.get('DEBUG', default=False))
15
14
16
- ALLOWED_HOSTS = ['*' ]
15
+ CORS_ALLOW_ALL_ORIGINS = True # If this is used then `CORS_ALLOWED_ORIGINS` will not have any effect
16
+ CORS_ALLOW_CREDENTIALS = True
17
+
18
+ CSRF_TRUSTED_ORIGINS = [
19
+ 'https://*.yandex-academy.ru' ,
20
+ 'http://localhost' ,
21
+ 'http://localhost:8000' ,
22
+ 'http://localhost:80' ,
23
+ 'http://0.0.0.0' ,
24
+ 'http://0.0.0.0:80' ,
25
+ 'http://0.0.0.0:8000' ,
26
+ 'http://127.0.0.1:8000' ,
27
+ 'http://127.0.0.1' ,
28
+ 'http://127.0.0.1:80'
29
+ ]
17
30
18
31
# Application definition
19
32
25
38
'django.contrib.messages' ,
26
39
'django.contrib.staticfiles' ,
27
40
'rest_framework' ,
28
- 'shop'
41
+ 'shop' ,
42
+ 'corsheaders'
29
43
]
30
44
31
45
MIDDLEWARE = [
36
50
'django.contrib.auth.middleware.AuthenticationMiddleware' ,
37
51
'django.contrib.messages.middleware.MessageMiddleware' ,
38
52
'django.middleware.clickjacking.XFrameOptionsMiddleware' ,
53
+ 'corsheaders.middleware.CorsMiddleware' ,
54
+ 'django.middleware.common.CommonMiddleware'
39
55
]
40
56
41
57
ROOT_URLCONF = 'core.urls'
Original file line number Diff line number Diff line change 6
6
import urllib .parse
7
7
import urllib .request
8
8
9
- API_BASEURL = 'http ://localhost:80 '
9
+ API_BASEURL = 'https ://responses-1920.usr.yandex-academy.ru '
10
10
11
11
12
12
ROOT_ID = "069cb8d7-bbdd-47d3-ad8f-82ef4c269df1"
@@ -239,8 +239,8 @@ def test_nodes():
239
239
240
240
def test_sales ():
241
241
status , response = request (f'/sales?date=2022-02-04T00:00:00.000Z' )
242
- print (response )
243
- print (status )
242
+ # print(response)
243
+ # print(status)
244
244
assert status == 200 , f"Expected HTTP status code 200, got { status } "
245
245
print ("Test sales passed." )
246
246
@@ -270,7 +270,7 @@ def test_delete():
270
270
def test_all ():
271
271
test_import ()
272
272
test_nodes ()
273
- # test_sales() # I have sales, but sometimes DEPLOYED app responses with 500
273
+ test_sales () # I have sales, but sometimes DEPLOYED app responses with 500
274
274
#test_stats()
275
275
test_delete ()
276
276
You can’t perform that action at this time.
0 commit comments