This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ ENV/
|
||||
# --- Django ---
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
/static/
|
||||
/staticfiles/ # ไม่เก็บไฟล์ที่รวบรวมแล้ว (เพราะเราจะรัน collectstatic ใน Docker)
|
||||
/media/
|
||||
.env
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ ENV/
|
||||
# --- Django ---
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
/static/
|
||||
/staticfiles/ # ไม่เก็บไฟล์ที่รวบรวมแล้ว (เพราะเราจะรัน collectstatic ใน Docker)
|
||||
/media/
|
||||
.env
|
||||
|
||||
|
||||
+4
-4
@@ -47,7 +47,7 @@ EXPOSE 8000
|
||||
# =========================
|
||||
# Run Application
|
||||
# =========================
|
||||
CMD ["gunicorn", "core.wsgi:application", \
|
||||
"--bind", "0.0.0.0:8000", \
|
||||
"--workers", "3", \
|
||||
"--timeout", "120"]
|
||||
# =========================
|
||||
# Run Application
|
||||
# =========================
|
||||
CMD ["python", "-m", "gunicorn", "core.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3", "--timeout", "120"]
|
||||
+6
-3
@@ -22,12 +22,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-vk@6jztjz7k6hb2%x%toy0*1&##oy%v%%c$o32w*ptq)+-b0$5'
|
||||
SECRET_KEY = os.environ.get("SECRET_KEY", "unsafe-dev-secret")
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
|
||||
# Application definition
|
||||
INSTALLED_APPS = [
|
||||
@@ -58,6 +58,7 @@ INSTALLED_APPS = [
|
||||
MIDDLEWARE = [
|
||||
'corsheaders.middleware.CorsMiddleware', # สำคัญมากสำหรับ Frontend
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
@@ -151,6 +152,8 @@ STATIC_URL = '/static/'
|
||||
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||
|
||||
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, 'static'),
|
||||
]
|
||||
|
||||
+23
-7
@@ -1,4 +1,4 @@
|
||||
version: '3.8'
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
db:
|
||||
@@ -6,20 +6,36 @@ services:
|
||||
container_name: postgres-db
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_DB: my_db
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_PASSWORD: password # รหัสผ่านสำหรับช่วงพัฒนาเท่านั้น
|
||||
POSTGRES_DB: lms
|
||||
POSTGRES_USER: lms
|
||||
POSTGRES_PASSWORD: lms123
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
# Healthcheck เพื่อให้ backend รอจนกว่า DB จะพร้อม
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U user -d my_db"]
|
||||
test: ["CMD-SHELL", "pg_isready -U lms -d lms"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
backend:
|
||||
build: .
|
||||
container_name: lms-backend
|
||||
restart: always
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
DJANGO_SETTINGS_MODULE: core.settings
|
||||
DEBUG: "false"
|
||||
DB_HOST: db
|
||||
DB_PORT: "5432"
|
||||
DB_NAME: lms
|
||||
DB_USER: lms
|
||||
DB_PASSWORD: lms123
|
||||
ports:
|
||||
- "8000:8000"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
minio_data:
|
||||
|
||||
@@ -6,3 +6,5 @@ django-allauth==65.16.1
|
||||
python-dotenv==1.2.2
|
||||
psycopg[binary]==3.3.3
|
||||
django-cors-headers==4.9.0
|
||||
gunicorn==25.3.0
|
||||
whitenoise==6.12.0
|
||||
@@ -0,0 +1,7 @@
|
||||
/* Import ฟอนต์ */
|
||||
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700&display=swap");
|
||||
|
||||
/* บังคับใช้ฟอนต์ทั้งระบบ */
|
||||
html, body, select, input, button, .unfold-admin {
|
||||
font-family: 'Noto Sans Thai', sans-serif !important;
|
||||
}
|
||||
Reference in New Issue
Block a user