From b78cd91ce8cca359442aa633a25858b0125a9ea2 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Mon, 29 Mar 2021 13:54:09 +0200 Subject: [PATCH 1/2] DEBUG_PROPAGATE_EXCEPTIONS = True This allows to print stack traces on the stdout Best practice would be to integrate with sentry, but at least print the stack trace is helpful when trying to deploy this Signed-off-by: Pierre Tardy --- vulnerablecode/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vulnerablecode/settings.py b/vulnerablecode/settings.py index 7c829e82f..c21db3ca3 100644 --- a/vulnerablecode/settings.py +++ b/vulnerablecode/settings.py @@ -26,6 +26,7 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False +DEBUG_PROPAGATE_EXCEPTIONS = True ALLOWED_HOSTS = [ ".herokuapp.com", From c2e1b23b4641ebe8678e990e434555ce222eee4b Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Mon, 29 Mar 2021 14:00:47 +0200 Subject: [PATCH 2/2] Enforce static collection in dockerfile Signed-off-by: Pierre Tardy --- Dockerfile | 3 ++- README.rst | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3cc935436..c4308986e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,8 @@ ENV PYTHONUNBUFFERED 1 RUN mkdir /vulnerablecode WORKDIR /vulnerablecode ADD . /vulnerablecode/ -RUN pip install -r requirements.txt +RUN pip install -r requirements.txt && \ + DJANGO_DEV=1 python manage.py collectstatic LABEL "base_image": "pkg:docker/python@sha256%3Ae9b7e3b4e9569808066c5901b8a9ad315a9f14ae8d3949ece22ae339fff2cad0" LABEL "dockerfile_url": "https://github.com/nexB/vulnerablecode/blob/develop/Dockerfile" diff --git a/README.rst b/README.rst index d328634c9..87428ea54 100644 --- a/README.rst +++ b/README.rst @@ -141,11 +141,12 @@ On Debian-based distros, these can be installed with:: **Application dependencies** -Create a virtualenv, install dependencies, and run the database migrations:: +Create a virtualenv, install dependencies, generate static files and run the database migrations:: python3 -m venv venv source venv/bin/activate pip install -r requirements.txt + DJANGO_DEV=1 python manage.py collectstatic DJANGO_DEV=1 python manage.py migrate The environment variable ``DJANGO_DEV`` is used to load settings suitable for