添加教程的API

This commit is contained in:
2025-06-14 16:48:26 +08:00
parent 92adfd5415
commit 258e1474ee
11 changed files with 86 additions and 11 deletions

View File

@@ -6,12 +6,8 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"HOST": get_env("POSTGRES_HOST", "127.0.0.1"),
"PORT": get_env("POSTGRES_PORT", "5432"),
"NAME": get_env("POSTGRES_DB", "onlinejudge"),
"USER": get_env("POSTGRES_USER", "onlinejudge"),
"PASSWORD": get_env("POSTGRES_PASSWORD", "onlinejudge"),
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}

View File

@@ -52,7 +52,8 @@ LOCAL_APPS = [
'options',
'judge',
'message',
'comment'
'comment',
'tutorial',
]
INSTALLED_APPS = VENDOR_APPS + LOCAL_APPS
@@ -209,10 +210,10 @@ def redis_config(db):
"KEY_FUNCTION": make_key
}
CACHES = {
"default": redis_config(db=1)
}
if production_env:
CACHES = {
"default": redis_config(db=1)
}
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default"

View File

@@ -17,4 +17,6 @@ urlpatterns = [
path("api/", include("message.urls.oj")),
path("api/", include("comment.urls.oj")),
path("api/admin/", include("comment.urls.admin")),
path("api/", include("tutorial.urls.tutorial")),
path("api/admin/", include("tutorial.urls.admin")),
]