File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ DEBUG=True
55SECRET_KEY = supersecretkey
66DJANGO_SECRET_KEY = supersecretkey
77ALLOWED_HOSTS = localhost,127.0.0.1
8+ CORS_ALLOWED_ORIGINS = http://localhost:8000,http://127.0.0.1:8000
89
910# =============================================
1011# БАЗА ДАННЫХ (PostgreSQL)
Original file line number Diff line number Diff line change 160160# ====================
161161# CORS SETTINGS
162162# ====================
163- CORS_ALLOWED_ORIGINS = [
164- "http://localhost:5173" , # Vite dev server
165- "http://127.0.0.1:5173" ,
166- "http://localhost:3000" , # Alternative frontend port
167- "http://127.0.0.1:3000" ,
168- ]
163+ # Настройки CORS (Cross-Origin Resource Sharing)
164+ CORS_ALLOWED_ORIGINS = env .list ("CORS_ALLOWED_ORIGINS" )
169165
166+ # Разрешить куки и заголовки авторизации
170167CORS_ALLOW_CREDENTIALS = True
171168
172- CORS_ALLOW_ALL_ORIGINS = DEBUG # Only allow all origins in development
169+ # Разрешенные методы (опционально, можно не указывать, так как по умолчанию разрешены безопасные методы)
170+ CORS_ALLOW_METHODS = [
171+ "DELETE" ,
172+ "GET" ,
173+ "OPTIONS" ,
174+ "PATCH" ,
175+ "POST" ,
176+ "PUT" ,
177+ ]
178+
179+ # Разрешенные заголовки (опционально)
180+ CORS_ALLOW_HEADERS = [
181+ "accept" ,
182+ "accept-encoding" ,
183+ "authorization" ,
184+ "content-type" ,
185+ "dnt" ,
186+ "origin" ,
187+ "user-agent" ,
188+ "x-csrftoken" ,
189+ "x-requested-with" ,
190+ ]
You can’t perform that action at this time.
0 commit comments