A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
updated settings: docker image runs without ENV variables
Jonas Winklerdc59e0f2579a
diff --git a/docker-compose.env.example b/docker-compose.env.exampleindex 175f65afe..cc2a1d3ec 100644--- a/docker-compose.env.example+++ b/docker-compose.env.example@@ -1,15 +1,6 @@# Database settings for paperless-# If you want to use sqlite instead, remove these settings.-PAPERLESS_DBENGINE="django.db.backends.postgresql_psycopg2"+# If you want to use sqlite instead, remove this setting.PAPERLESS_DBHOST="db"-PAPERLESS_DBNAME="paperless"-PAPERLESS_DBUSER="paperless"-PAPERLESS_DBPASS="paperless"--# DONT EDIT. Consumption directory. This is the location of the consumption-# directory inside the container. If you want to modify the location of the-# consumption folder on the host, edit the docker-compose.yml file instead.-PAPERLESS_CONSUMPTION_DIR="../consume"# The UID and GID of the user used to run paperless in the container. Set this# to your UID and GID on the host so that you have write access to thediff --git a/paperless.conf.example b/paperless.conf.exampleindex c1bf62cd9..41ac778e7 100644--- a/paperless.conf.example+++ b/paperless.conf.example@@ -10,7 +10,14 @@# By default, sqlite is used as the database backend. This can be changed here.# The docker-compose service definition uses a postgresql server. The# configuration for this is already done inside the docker-compose.env file.-#PAPERLESS_DBENGINE="django.db.backends.postgresql_psycopg2"++#Set PAPERLESS_DBHOST and postgresql will be used instead of mysql.+#PAPERLESS_DBHOST="localhost"++#Adjust port if necessary+#PAPERLESS_DBPORT=++#name, user and pass all default to "paperless"#PAPERLESS_DBNAME="paperless"#PAPERLESS_DBUSER="paperless"#PAPERLESS_DBPASS="paperless"diff --git a/src/documents/index.py b/src/documents/index.pyindex e3b391569..33a745701 100644--- a/src/documents/index.py+++ b/src/documents/index.py@@ -1,3 +1,5 @@+import logging+from django.db import modelsfrom django.dispatch import receiverfrom whoosh.fields import Schema, TEXT, NUMERIC@@ -65,6 +67,7 @@ def open_index(recreate=False):def update_document(writer, doc):+ logging.getLogger(__name__).debug("Updating index with document{}".format(str(doc)))writer.update_document(id=doc.id,title=doc.title,@@ -81,6 +84,7 @@ def add_document_to_index(sender, instance, **kwargs):@receiver(models.signals.post_delete, sender=Document)def remove_document_from_index(sender, instance, **kwargs):+ logging.getLogger(__name__).debug("Removing document {} from index".format(str(instance)))ix = open_index()with AsyncWriter(ix) as writer:writer.delete_by_term('id', instance.id)diff --git a/src/paperless/settings.py b/src/paperless/settings.pyindex 737a0a3d5..e6aa86217 100644--- a/src/paperless/settings.py+++ b/src/paperless/settings.py@@ -36,6 +36,12 @@ THUMBNAIL_DIR = os.path.join(MEDIA_ROOT, "documents", "thumbnails")DATA_DIR = os.getenv('PAPERLESS_DATA_DIR', os.path.join(BASE_DIR, "..", "data"))INDEX_DIR = os.path.join(DATA_DIR, "index")MODEL_FILE = os.path.join(DATA_DIR, "classification_model.pickle")++CONSUMPTION_DIR = os.getenv("PAPERLESS_CONSUMPTION_DIR", os.path.join(BASE_DIR, "..", "consume"))++# This will be created if it doesn't exist+SCRATCH_DIR = os.getenv("PAPERLESS_SCRATCH_DIR", "/tmp/paperless")+################################################################################ Application Definition ################################################################################@@ -187,16 +193,14 @@ DATABASES = {# This is important when migrating to/from sqliteDATABASES['sqlite'] = DATABASES['default'].copy()-if os.getenv("PAPERLESS_DBENGINE"):+if os.getenv("PAPERLESS_DBHOST"):DATABASES["default"] = {- "ENGINE": os.getenv("PAPERLESS_DBENGINE"),+ "ENGINE": "django.db.backends.postgresql_psycopg2",+ "HOST": os.getenv("PAPERLESS_DBHOST"),"NAME": os.getenv("PAPERLESS_DBNAME", "paperless"),- "USER": os.getenv("PAPERLESS_DBUSER"),+ "USER": os.getenv("PAPERLESS_DBUSER", "paperless"),+ "PASSWORD": os.getenv("PAPERLESS_DBPASS", "paperless"),}- if os.getenv("PAPERLESS_DBPASS"):- DATABASES["default"]["PASSWORD"] = os.getenv("PAPERLESS_DBPASS")- if os.getenv("PAPERLESS_DBHOST"):- DATABASES["default"]["HOST"] = os.getenv("PAPERLESS_DBHOST")if os.getenv("PAPERLESS_DBPORT"):DATABASES["default"]["PORT"] = os.getenv("PAPERLESS_DBPORT")@@ -264,11 +268,6 @@ GS_BINARY = os.getenv("PAPERLESS_GS_BINARY", "gs")OPTIPNG_BINARY = os.getenv("PAPERLESS_OPTIPNG_BINARY", "optipng")UNPAPER_BINARY = os.getenv("PAPERLESS_UNPAPER_BINARY", "unpaper")-# This will be created if it doesn't exist-SCRATCH_DIR = os.getenv("PAPERLESS_SCRATCH_DIR", "/tmp/paperless")--# This is where Paperless will look for PDFs to index-CONSUMPTION_DIR = os.getenv("PAPERLESS_CONSUMPTION_DIR")# Pre-2.x versions of Paperless stored your documents locally with GPG# encryption, but that is no longer the default. This behaviour is still