init: django project with CI pipeline
Some checks failed
Build and Push Docker Image / build (push) Failing after 2m47s
Some checks failed
Build and Push Docker Image / build (push) Failing after 2m47s
This commit is contained in:
0
app/__init__.py
Normal file
0
app/__init__.py
Normal file
25
app/settings.py
Normal file
25
app/settings.py
Normal 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
13
app/urls.py
Normal 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
5
app/wsgi.py
Normal 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()
|
||||
Reference in New Issue
Block a user