zeroed-some/bashamole / b1924bb

Browse files

prep for initial deployment

Authored by espadonne
SHA
b1924bb58413ce2b68035801ab47c905847b032c
Parents
f94d487
Tree
b2869f3

4 changed files

StatusFile+-
M backend/bashamole/settings.py 22 3
M backend/requirements.txt 4 0
A backend/runtime.txt 1 0
D frontend/src/app/favicon.ico bin
backend/bashamole/settings.pymodified
@@ -9,7 +9,8 @@ https://docs.djangoproject.com/en/5.2/topics/settings/
99
 For the full list of settings and their values, see
1010
 https://docs.djangoproject.com/en/5.2/ref/settings/
1111
 """
12
-
12
+import os
13
+import dj_database_url
1314
 from pathlib import Path
1415
 
1516
 # Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -25,8 +26,22 @@ SECRET_KEY = "django-insecure-xykf5$__a(xn*avfxs2njr#==cn7*+t8kg+4_lbi$(#+@5_j8g
2526
 # SECURITY WARNING: don't run with debug turned on in production!
2627
 DEBUG = True
2728
 
28
-ALLOWED_HOSTS = []
29
+ALLOWED_HOSTS = [
30
+    'localhost',
31
+    '127.0.0.1',
32
+    '.railway.app',
33
+    '.up.railway.app',
34
+]
35
+
36
+# Database - Railway provides DATABASE_URL automatically
37
+if os.environ.get('DATABASE_URL'):
38
+    DATABASES = {
39
+        'default': dj_database_url.parse(os.environ.get('DATABASE_URL'))
40
+    }
2941
 
42
+# Static files
43
+STATIC_URL = '/static/'
44
+STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
3045
 
3146
 # Application definition
3247
 
@@ -52,6 +67,7 @@ MIDDLEWARE = [
5267
     "django.middleware.clickjacking.XFrameOptionsMiddleware",
5368
     'corsheaders.middleware.CorsMiddleware',
5469
     'django.middleware.common.CommonMiddleware',
70
+    "whitenoise.middleware.WhiteNoiseMiddleware",
5571
 ]
5672
 
5773
 ROOT_URLCONF = "bashamole.urls"
@@ -136,3 +152,6 @@ REST_FRAMEWORK = {
136152
     'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
137153
     'PAGE_SIZE': 100
138154
 }
155
+
156
+if os.environ.get('FRONTEND_URL'):
157
+    CORS_ALLOWED_ORIGINS.append(os.environ.get('FRONTEND_URL'))
backend/requirements.txtmodified
@@ -3,3 +3,7 @@ Django==5.2.3
33
 django-cors-headers==4.7.0
44
 djangorestframework==3.16.0
55
 sqlparse==0.5.3
6
+gunicorn==21.2.0
7
+whitenoise==6.6.0
8
+dj-database-url==2.1.0
9
+psycopg2-binary==2.9.9
backend/runtime.txtadded
@@ -0,0 +1,1 @@
1
+3.11.x
frontend/src/app/favicon.icodeleted
Binary file changed.