Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Commit

Permalink
Merge 0b4c660 into 6d8e4ad
Browse files Browse the repository at this point in the history
  • Loading branch information
ovv committed Jan 30, 2019
2 parents 6d8e4ad + 0b4c660 commit bc32b1e
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 27 deletions.
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ django-filter = "*"
djangorestframework = "*"
factory-boy = "*"
filemagic = "*"
fuzzywuzzy = {extras = ["speedup"], version = "==0.15.0"}
fuzzywuzzy = {extras = ["speedup"],version = "==0.15.0"}
gunicorn = "*"
inotify-simple = "*"
langdetect = "*"
Expand All @@ -36,6 +36,7 @@ pytest-env = "*"
pytest-xdist = "*"
psycopg2 = "*"
djangoql = "*"
pyyaml = "*"

[dev-packages]
ipython = "*"
45 changes: 31 additions & 14 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 31 additions & 12 deletions src/paperless/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@
"""

import os
import yaml

from dotenv import load_dotenv


# Tap paperless.conf if it's available
if os.path.exists("/etc/paperless.conf"):
load_dotenv("/etc/paperless.conf")
elif os.path.exists("/etc/paperless/paperless.conf"):
load_dotenv("/etc/paperless/paperless.conf")
elif os.path.exists("/usr/local/etc/paperless.conf"):
load_dotenv("/usr/local/etc/paperless.conf")
elif os.path.exists("/usr/local/etc/paperless/paperless.conf"):
load_dotenv("/usr/local/etc/paperless/paperless.conf")


def __get_boolean(key, default="NO"):
Expand Down Expand Up @@ -222,18 +227,32 @@ def __get_boolean(key, default="NO"):

# Logging

LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {
"consumer": {
"class": "documents.loggers.PaperlessLogger",
}
},
"loggers": {
"documents": {
"handlers": ["consumer"],
"level": os.getenv("PAPERLESS_CONSUMER_LOG_LEVEL", "INFO"),
# Django use the python dictConfig format for logging. For more info See:
# * https://docs.djangoproject.com/en/2.1/topics/logging/
# * https://docs.python.org/3/library/logging.config.html#logging-config-dictschema
#
# Removing the default logging configuration will disable logging into the database
# and the log view from the interface

if os.path.exists("/etc/paperless/logging.yml"):
with open("/etc/paperless/logging.yml", 'r') as config:
LOGGING = yaml.load(config)
elif os.path.exists("/usr/local/etc/paperless/logging.yml"):
with open("/usr/local/etc/paperless/logging.yml", 'r') as config:
LOGGING = yaml.load(config)
else:
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {
"consumer": {
"class": "documents.loggers.PaperlessLogger",
}
},
"loggers": {
"documents": {
"handlers": ["consumer"],
"level": os.getenv("PAPERLESS_CONSUMER_LOG_LEVEL", "INFO"),
},
},
}
Expand Down

0 comments on commit bc32b1e

Please sign in to comment.