From 0d164a1f31381f6c9854f2daaf2b422c9338bd43 Mon Sep 17 00:00:00 2001 From: Paul Mathieu Date: Mon, 3 Jul 2023 19:56:32 +0200 Subject: [PATCH] Now deployable --- Dockerfile | 6 +++--- backend/zetikettes/zetikettes/settings.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6260547..e56abd1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM alpine RUN apk --no-cache add python3 inkscape bash imagemagick ttf-opensans -RUN apk --no-cache add py3-pip && pip3 install django tzdata +RUN apk --no-cache add py3-pip && pip3 install django tzdata gunicorn ADD backend /root/zetikettes @@ -11,5 +11,5 @@ RUN mkdir -p /usr/share/fonts/TTF \ # the script will look for templates in /data -WORKDIR /root/zetikettes -CMD /usr/bin/python3 zetikettes/manage.py runserver 0.0.0.0:8000 +WORKDIR /root/zetikettes/zetikettes +CMD /usr/bin/gunicorn zetikettes.wsgi -b 0.0.0.0:8000 --timeout 600 diff --git a/backend/zetikettes/zetikettes/settings.py b/backend/zetikettes/zetikettes/settings.py index 73a4063..367038a 100644 --- a/backend/zetikettes/zetikettes/settings.py +++ b/backend/zetikettes/zetikettes/settings.py @@ -18,7 +18,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent #TIKETTE_OUT_DIR = BASE_DIR / 'data' TIKETTE_OUT_DIR = Path('/data') MEDIA_ROOT = TIKETTE_OUT_DIR -MEDIA_URL = 'data/' +MEDIA_URL = '/data/' # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ @@ -29,7 +29,9 @@ SECRET_KEY = 'django-insecure-64qxpe55#9wy=5@#dl0)3w7ywxh48m!f&!slp9e7v4lh@hjdct # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['aerith.ponteilla.net'] + +CSRF_TRUSTED_ORIGINS = ['https://aerith.ponteilla.net'] # Application definition @@ -122,6 +124,8 @@ USE_TZ = True STATIC_URL = 'static/' +STATIC_ROOT = 'www_static' + # Default primary key field type # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field