tenseleyflow/jubjubword / 58a4754

Browse files

production settings, deps

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
58a4754036e7e90eb50c9fc119e22cba93b633e4
Parents
ac95048
Tree
91d0ec4

6 changed files

StatusFile+-
A backend/jubjub/__init__.py 0 0
A backend/jubjub/asgi.py 16 0
A backend/jubjub/settings.py 147 0
A backend/jubjub/urls.py 23 0
A backend/jubjub/wsgi.py 16 0
A backend/requirements.txt 7 0
backend/jubjub/__init__.pyadded
backend/jubjub/asgi.pyadded
@@ -0,0 +1,16 @@
1
+"""
2
+ASGI config for jubjub project.
3
+
4
+It exposes the ASGI callable as a module-level variable named ``application``.
5
+
6
+For more information on this file, see
7
+https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/
8
+"""
9
+
10
+import os
11
+
12
+from django.core.asgi import get_asgi_application
13
+
14
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jubjub.settings')
15
+
16
+application = get_asgi_application()
backend/jubjub/settings.pyadded
@@ -0,0 +1,147 @@
1
+"""
2
+Django settings for jubjub project.
3
+
4
+Generated by 'django-admin startproject' using Django 5.2.1.
5
+
6
+For more information on this file, see
7
+https://docs.djangoproject.com/en/5.2/topics/settings/
8
+
9
+For the full list of settings and their values, see
10
+https://docs.djangoproject.com/en/5.2/ref/settings/
11
+"""
12
+
13
+import os
14
+from pathlib import Path
15
+
16
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
17
+BASE_DIR = Path(__file__).resolve().parent.parent
18
+
19
+
20
+# Quick-start development settings - unsuitable for production
21
+# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
22
+
23
+# SECURITY WARNING: keep the secret key used in production secret!
24
+SECRET_KEY = os.environ.get('SECRET_KEY', 'django-insecure-6r_6@6-zgta=-n0i@5cr&deq3ejubkjsu(298s39a#_oplye$4')
25
+
26
+# SECURITY WARNING: don't run with debug turned on in production!
27
+DEBUG = os.environ.get('DEBUG', 'True').lower() == 'true'
28
+
29
+ALLOWED_HOSTS = []
30
+if os.environ.get('ALLOWED_HOSTS'):
31
+    ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS').split(',')
32
+elif DEBUG:
33
+    ALLOWED_HOSTS = ['localhost', '127.0.0.1']
34
+
35
+
36
+# Application definition
37
+
38
+INSTALLED_APPS = [
39
+    'django.contrib.admin',
40
+    'django.contrib.auth',
41
+    'django.contrib.contenttypes',
42
+    'django.contrib.sessions',
43
+    'django.contrib.messages',
44
+    'django.contrib.staticfiles',
45
+    'rest_framework',
46
+    'corsheaders',
47
+    'jubjub.jubjubword',
48
+]
49
+
50
+MIDDLEWARE = [
51
+    'corsheaders.middleware.CorsMiddleware',
52
+    'django.middleware.security.SecurityMiddleware',
53
+    'whitenoise.middleware.WhiteNoiseMiddleware',
54
+    'django.contrib.sessions.middleware.SessionMiddleware',
55
+    'django.middleware.common.CommonMiddleware',
56
+    'django.middleware.csrf.CsrfViewMiddleware',
57
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
58
+    'django.contrib.messages.middleware.MessageMiddleware',
59
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
60
+]
61
+
62
+ROOT_URLCONF = 'jubjub.urls'
63
+
64
+TEMPLATES = [
65
+    {
66
+        'BACKEND': 'django.template.backends.django.DjangoTemplates',
67
+        'DIRS': [],
68
+        'APP_DIRS': True,
69
+        'OPTIONS': {
70
+            'context_processors': [
71
+                'django.template.context_processors.request',
72
+                'django.contrib.auth.context_processors.auth',
73
+                'django.contrib.messages.context_processors.messages',
74
+            ],
75
+        },
76
+    },
77
+]
78
+
79
+WSGI_APPLICATION = 'jubjub.wsgi.application'
80
+
81
+
82
+# Database
83
+# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
84
+
85
+DATABASES = {
86
+    'default': {
87
+        'ENGINE': 'django.db.backends.sqlite3',
88
+        'NAME': BASE_DIR / 'db.sqlite3',
89
+    }
90
+}
91
+
92
+
93
+# Password validation
94
+# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
95
+
96
+AUTH_PASSWORD_VALIDATORS = [
97
+    {
98
+        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
99
+    },
100
+    {
101
+        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
102
+    },
103
+    {
104
+        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
105
+    },
106
+    {
107
+        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
108
+    },
109
+]
110
+
111
+
112
+# Internationalization
113
+# https://docs.djangoproject.com/en/5.2/topics/i18n/
114
+
115
+LANGUAGE_CODE = 'en-us'
116
+
117
+TIME_ZONE = 'UTC'
118
+
119
+USE_I18N = True
120
+
121
+USE_TZ = True
122
+
123
+
124
+# Static files (CSS, JavaScript, Images)
125
+# https://docs.djangoproject.com/en/5.2/howto/static-files/
126
+
127
+STATIC_URL = 'static/'
128
+STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')  # Add this for production
129
+
130
+# Default primary key field type
131
+# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
132
+
133
+DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
134
+
135
+CORS_ALLOWED_ORIGINS = [
136
+    "http://localhost:3000",  # Next.js default port
137
+]
138
+
139
+# Add production frontend URL if provided
140
+if os.environ.get('FRONTEND_URL'):
141
+    CORS_ALLOWED_ORIGINS.append(os.environ.get('FRONTEND_URL'))
142
+
143
+REST_FRAMEWORK = {
144
+    'DEFAULT_PERMISSION_CLASSES': [
145
+        'rest_framework.permissions.AllowAny',
146
+    ]
147
+}
backend/jubjub/urls.pyadded
@@ -0,0 +1,23 @@
1
+"""
2
+URL configuration for jubjub project.
3
+
4
+The `urlpatterns` list routes URLs to views. For more information please see:
5
+    https://docs.djangoproject.com/en/5.2/topics/http/urls/
6
+Examples:
7
+Function views
8
+    1. Add an import:  from my_app import views
9
+    2. Add a URL to urlpatterns:  path('', views.home, name='home')
10
+Class-based views
11
+    1. Add an import:  from other_app.views import Home
12
+    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
13
+Including another URLconf
14
+    1. Import the include() function: from django.urls import include, path
15
+    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
16
+"""
17
+from django.contrib import admin
18
+from django.urls import path, include
19
+
20
+urlpatterns = [
21
+    path('admin/', admin.site.urls),
22
+    path('api/', include('jubjub.jubjubword.urls')),
23
+]
backend/jubjub/wsgi.pyadded
@@ -0,0 +1,16 @@
1
+"""
2
+WSGI config for jubjub project.
3
+
4
+It exposes the WSGI callable as a module-level variable named ``application``.
5
+
6
+For more information on this file, see
7
+https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/
8
+"""
9
+
10
+import os
11
+
12
+from django.core.wsgi import get_wsgi_application
13
+
14
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jubjub.settings')
15
+
16
+application = get_wsgi_application()
backend/requirements.txtadded
@@ -0,0 +1,7 @@
1
+asgiref==3.8.1
2
+Django==5.2.1
3
+django-cors-headers==4.7.0
4
+djangorestframework==3.16.0
5
+sqlparse==0.5.3
6
+whitenoise==6.6.0
7
+gunicorn==21.2.0