mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
updated settings: docker image runs without ENV variables
This commit is contained in:
parent
9ce926df7f
commit
dc59e0f257
@ -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 the
|
||||
|
@ -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"
|
||||
|
@ -1,3 +1,5 @@
|
||||
import logging
|
||||
|
||||
from django.db import models
|
||||
from django.dispatch import receiver
|
||||
from 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)
|
||||
|
@ -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 sqlite
|
||||
DATABASES['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
|
||||
|
Loading…
x
Reference in New Issue
Block a user