Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Allow users to set their own SECRET_KEY value

Daniel Quinn92db3fec2e2f
diff --git a/paperless.conf.example b/paperless.conf.example
index 005a22584..b6067be31 100644
--- a/paperless.conf.example
+++ b/paperless.conf.example
@@ -116,3 +116,8 @@ PAPERLESS_SHARED_SECRET=""
# positive integer, but if you don't define one in paperless.conf, a default of
# 100 will be used.
#PAPERLESS_LIST_PER_PAGE=100
+
+# The secret key has a default that should be fine so long as you're hosting
+# Paperless on a closed network. However, if you're putting this anywhere
+# public, you should change the key to something unique and verbose.
+#PAPERLESS_SECRET_KEY="change-me"
diff --git a/src/paperless/settings.py b/src/paperless/settings.py
index ff67cc528..40132ff0b 100644
--- a/src/paperless/settings.py
+++ b/src/paperless/settings.py
@@ -21,8 +21,13 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
-# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = 'e11fl1oa-*ytql8p)(06fbj4ukrlo+n7k&q5+$1md7i+mge=ee'
+# The secret key has a default that should be fine so long as you're hosting
+# Paperless on a closed network. However, if you're putting this anywhere
+# public, you should change the key to something unique and verbose.
+SECRET_KEY = os.getenv(
+ "PAPERLESS_SECRET_KEY",
+ "e11fl1oa-*ytql8p)(06fbj4ukrlo+n7k&q5+$1md7i+mge=ee"
+)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True