init: django project with CI pipeline
Some checks failed
Build and Push Docker Image / build (push) Failing after 2m47s

This commit is contained in:
2026-02-08 12:40:31 +08:00
commit a8af8d1b64
9 changed files with 103 additions and 0 deletions

0
app/__init__.py Normal file
View File

25
app/settings.py Normal file
View File

@@ -0,0 +1,25 @@
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'dev-secret-key-change-in-production')
DEBUG = os.environ.get('DJANGO_DEBUG', 'False').lower() == 'true'
ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', '*').split(',')
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.middleware.common.CommonMiddleware',
]
ROOT_URLCONF = 'app.urls'
WSGI_APPLICATION = 'app.wsgi.application'
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

13
app/urls.py Normal file
View File

@@ -0,0 +1,13 @@
from django.http import JsonResponse
def health(request):
return JsonResponse({'status': 'ok'})
urlpatterns = []
# 使用简单的路由,避免引入 django.contrib.admin
from django.urls import path
urlpatterns = [
path('', health),
path('health/', health),
]

5
app/wsgi.py Normal file
View File

@@ -0,0 +1,5 @@
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
application = get_wsgi_application()