From 60932c57f94d1d56eaf1a80d3e3de4c015757bf8 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Mon, 10 Mar 2025 17:41:39 +0800 Subject: [PATCH] update --- api/settings.py | 9 +++++++++ entrypoint.sh | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/api/settings.py b/api/settings.py index 9f021c3..a4d3c52 100644 --- a/api/settings.py +++ b/api/settings.py @@ -105,10 +105,19 @@ PROD_DATABASES = { }, } +PROD_CACHES = { + "default": { + "BACKEND": "django.core.cache.backends.db.DatabaseCache", + "LOCATION": "webpreview_api_cache", + } +} + if DEBUG: DATABASES = DEV_DATABASES else: DATABASES = PROD_DATABASES + SESSION_ENGINE = "django.contrib.sessions.backends.cache" + CACHES = PROD_CACHES # Password validation # https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators diff --git a/entrypoint.sh b/entrypoint.sh index 2c7f6c3..0232825 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/sh +python manage.py createcachetable python manage.py migrate --noinput -exec gunicorn --bind 0.0.0.0:8000 api.wsgi:application -w 5 \ No newline at end of file +exec gunicorn --bind 0.0.0.0:8000 api.asgi:application -k uvicorn.workers.UvicornWorker -w 5 \ No newline at end of file