From 425f87618ad078d1e2a21f2bf8e121f771d7798e Mon Sep 17 00:00:00 2001 From: Dashie Date: Wed, 1 Feb 2017 00:22:32 +0100 Subject: [PATCH 1/2] Add config option to override STATIC_ROOT --- paperless.conf.example | 4 ++++ src/paperless/settings.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/paperless.conf.example b/paperless.conf.example index b6067be31..537895110 100644 --- a/paperless.conf.example +++ b/paperless.conf.example @@ -88,6 +88,10 @@ PAPERLESS_SHARED_SECRET="" # Override the default MEDIA_ROOT here. This is where all files are stored. #PAPERLESS_MEDIADIR=/path/to/media +# Override the default STATIC_ROOT here. This is where all static files created +# using "collectstatic" manager command are stored. +#PAPERLESS_STATICDIR="" + # The number of seconds that Paperless will wait between checking # PAPERLESS_CONSUMPTION_DIR. If you tend to write documents to this directory # very slowly, you may want to use a higher value than the default (10). diff --git a/src/paperless/settings.py b/src/paperless/settings.py index a4ef12320..e8afb9545 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -162,7 +162,8 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ -STATIC_ROOT = os.path.join(BASE_DIR, "..", "static") +STATIC_ROOT = os.getenv( + "PAPERLESS_STATICDIR", os.path.join(BASE_DIR, "..", "static")) MEDIA_ROOT = os.getenv( "PAPERLESS_MEDIADIR", os.path.join(BASE_DIR, "..", "media")) From 7699a881d01874676c60b1ebee91b4ed83b593b3 Mon Sep 17 00:00:00 2001 From: Dashie Date: Wed, 1 Feb 2017 00:28:37 +0100 Subject: [PATCH 2/2] Add check for PAPERLESS_MEDIADIR --- src/paperless/checks.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/paperless/checks.py b/src/paperless/checks.py index f57a838bb..2e7bdf8db 100644 --- a/src/paperless/checks.py +++ b/src/paperless/checks.py @@ -49,6 +49,20 @@ def paths_check(app_configs, **kwargs): writeable_hint.format(directory) )) + directory = os.getenv("PAPERLESS_STATICDIR") + if directory: + if not os.path.exists(directory): + check_messages.append(Error( + exists_message.format("PAPERLESS_STATICDIR"), + exists_hint.format(directory) + )) + if not check_messages: + if not os.access(directory, os.W_OK | os.X_OK): + check_messages.append(Error( + writeable_message.format("PAPERLESS_STATICDIR"), + writeable_hint.format(directory) + )) + return check_messages