Skip to content

Commit 3ce0c37

Browse files
t
1 parent 2e34705 commit 3ce0c37

File tree

239 files changed

+13
-43371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+13
-43371
lines changed

API/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.idea
99
.env
1010
myenv
11+
/prod_static
1112
# Icon must end with two \r
1213
Icon
1314

API/API/settings.py

+10-37
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
from dotenv import load_dotenv
1616
import datetime
1717

18-
19-
2018
import Apps.Tournament.apps
2119
from Apps.Profile.logger import CustomisedJSONFormatter
2220

@@ -28,28 +26,14 @@
2826
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
2927

3028
# SECURITY WARNING: keep the secret key used in production secret!
31-
SECRET_KEY = '0a4fd7e3567eab20bab2f2d6682ea96d0d865050bfcde9c293aa7f9ec48bce55'
29+
SECRET_KEY = os.getenv('SECRET_KEY')
3230

33-
#yeni
3431
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "API.settings")
3532

36-
# SECURITY WARNING: don't run with debug turned on in production!
37-
DEBUG = True
38-
39-
ALLOWED_HOSTS = ['*']
40-
CSRF_TRUSTED_ORIGINS = [
41-
"http://localhost:3000",
42-
"http://127.0.0.1:3000"
43-
"http://localhost:3030",
44-
]
45-
CORS_ALLOWED_ORIGINS = [
46-
"http://localhost:3000",
47-
"http://127.0.0.1:3000",
48-
"http://localhost:3030",
49-
]
33+
DEBUG = False
5034

5135
CORS_ALLOW_CREDENTIALS = True
52-
36+
ALLOWED_HOSTS = ['*']
5337
INSTALLED_APPS = [
5438
'daphne',
5539
'uvicorn',
@@ -72,9 +56,7 @@
7256
"Apps.Game.apps.GameConfig",
7357
]
7458

75-
7659
STATIC_URL = '/static/'
77-
APP_ID = 'elk_demo'
7860
LOGGING = {
7961
'version': 1,
8062
'disable_existing_loggers': False,
@@ -108,17 +90,19 @@
10890
}
10991
}
11092

111-
STATIC_ROOT = Path(BASE_DIR).resolve().joinpath('BASE_DIR', 'static');
112-
STATICFILES_DIRS = []
113-
114-
93+
APP_ID = 'elk_demo'
94+
STATIC_ROOT = Path(BASE_DIR).resolve().joinpath('prod_static');
95+
STATICFILES_DIRS = [
96+
BASE_DIR / "static",
97+
]
11598
MIDDLEWARE = [
11699
'django.middleware.security.SecurityMiddleware',
117100
'django.contrib.sessions.middleware.SessionMiddleware',
118101
"corsheaders.middleware.CorsMiddleware",
119102
"django.middleware.common.CommonMiddleware",
120103
'django.contrib.auth.middleware.AuthenticationMiddleware',
121104
'django.contrib.messages.middleware.MessageMiddleware',
105+
'django.middleware.csrf.CsrfViewMiddleware',
122106
'django.middleware.clickjacking.XFrameOptionsMiddleware',
123107
]
124108

@@ -158,23 +142,16 @@
158142
'rest_framework_simplejwt.authentication.JWTAuthentication',
159143
),
160144
'DEFAULT_THROTTLE_CLASSES': [
161-
162145
'rest_framework.throttling.AnonRateThrottle',
163-
164146
'rest_framework.throttling.UserRateThrottle'
165-
166147
],
167148
'DEFAULT_THROTTLE_RATES': {
168-
169149
'anon': '50/min',
170-
171150
'user': '100/min'
172-
173151
}
174152
}
175153

176-
STATIC_URL = '/static/'
177-
STATICFILES_DIRS = [BASE_DIR / 'static']
154+
178155
# Database
179156
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
180157

@@ -189,7 +166,6 @@
189166
}
190167
}
191168

192-
193169
# Password validation
194170
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
195171

@@ -208,7 +184,6 @@
208184
},
209185
]
210186

211-
212187
# Internationalization
213188
# https://docs.djangoproject.com/en/5.0/topics/i18n/
214189

@@ -220,7 +195,6 @@
220195

221196
USE_TZ = True
222197

223-
224198
# Static files (CSS, JavaScript, Images)
225199
# https://docs.djangoproject.com/en/5.0/howto/static-files/
226200

@@ -258,7 +232,6 @@
258232
'SLIDING_TOKEN_REFRESH_LIFETIME': datetime.timedelta(days=1),
259233
}
260234

261-
262235
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
263236
EMAIL_USE_TLS = True
264237
EMAIL_PORT = 587

API/Apps/Profile/api/views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from rest_framework.response import Response
1717
from rest_framework.views import APIView
1818

19-
logger = logging.getLogger(__name__)
19+
#logger = logging.getLogger(__name__)
2020

2121

2222
@authentication_classes([JWTAuthentication])
@@ -88,7 +88,7 @@ def get(self, request):
8888
return Response({"error": "Profile not found"}, status=404)
8989
stats = profile.stats
9090
serializer = ProfileStatsSerializer(stats)
91-
logger.info('Profile stats retrieved', extra={'profile': profile.nickname})
91+
#logger.info('Profile stats retrieved', extra={'profile': profile.nickname})
9292
return Response(serializer.data, status=200)
9393

9494
def post(self, request, profile_id):

API/static/wsgi.py

-16
This file was deleted.

0 commit comments

Comments
 (0)