From 4e58899e54298311ab823a01a563c650c1ef33c7 Mon Sep 17 00:00:00 2001 From: Ross Date: Tue, 3 May 2022 18:34:33 +0100 Subject: [PATCH] . --- Dockerfile | 23 +++++++++++++++++++++++ rad/settings.py | 10 +++++++--- requirements.txt | 5 +++-- 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..375d654e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# pull official base image +FROM python:3.10.4-slim + +# set work directory +WORKDIR /usr/src/rad + +# set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Numpy requriements +#RUN apk add --no-cache --update \ +# python3 python3-dev gcc \ +# gfortran musl-dev \ +# libffi-dev openssl-dev + +# install dependencies +RUN pip install --upgrade pip +COPY ./requirements.txt . +RUN pip install -r requirements.txt + +# copy project +COPY . . \ No newline at end of file diff --git a/rad/settings.py b/rad/settings.py index f3984d4c..be6214cd 100644 --- a/rad/settings.py +++ b/rad/settings.py @@ -19,11 +19,15 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -with open("/etc/secret_key") as f: - SECRET_KEY = f.read().strip() +try: + with open("/etc/secret_key") as f: + SECRET_KEY = f.read().strip() +except: + SECRET_KEY = os.environ.get("SECRET_KEY") + # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = int(os.environ.get("DEBUG", default=0)) ALLOWED_HOSTS = [ "localhost", diff --git a/requirements.txt b/requirements.txt index e84314d9..5336eb24 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django +Django==3.2.13 django_debug_toolbar django_jquery django_reversion @@ -24,4 +24,5 @@ pymemcache django-autocomplete-light django-querysetsequence dicognito -django_unused_media \ No newline at end of file +django_unused_media +gunicorn \ No newline at end of file