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

Commit

Permalink
fixed folders, compatible with previous paperless version
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Winkler committed Oct 29, 2020
1 parent 024c28a commit 5c48497
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 24 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ scripts/nuke
/static/

# Stored PDFs
/data/media/documents/*
/data/media/thumbnails/*
/media/documents/originals/*
/media/documents/thumbnails/*

/data/classification_model.pickle
/data/db.sqlite3
/data/index
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ RUN apt-get update \
unpaper \
&& pip install --upgrade pipenv \
&& pipenv install --system --deploy \
&& pipenv --clear \
&& apt-get -y purge build-essential \
&& apt-get -y autoremove --purge \
&& rm -rf /var/lib/apt/lists/*
Expand Down
File renamed without changes.
File renamed without changes.
Empty file.
7 changes: 5 additions & 2 deletions paperless.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@
# before you start Paperless.
#PAPERLESS_CONSUMPTION_DIR=""

# This is where paperless stores all its data (documents, thumbnails, search
# index, sqlite database, etc).
# This is where paperless stores all its data (search index, sqlite database,
# classification model, etc).
#PAPERLESS_DATA_DIR="../data"

# This is where your documents and thumbnails are stored.
#PAPERLESS_MEDIA_ROOT="../media"

# Override the default STATIC_ROOT here. This is where all static files
# created using "collectstatic" manager command are stored.
#PAPERLESS_STATICDIR="../static"
Expand Down
28 changes: 13 additions & 15 deletions scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,25 @@ map_uidgid() {
}

migrations() {
# A simple lock file in case other containers use this startup
LOCKFILE="/usr/src/paperless/data/db.sqlite3.migration"

# check for and create lock file in one command
if (set -o noclobber; echo "$$" > "${LOCKFILE}") 2> /dev/null
then
trap 'rm -f "${LOCKFILE}"; exit $?' INT TERM EXIT
sudo -HEu paperless python3 manage.py migrate
rm ${LOCKFILE}
fi

(
# flock is in place to prevent multiple containers from doing migrations
# simultaneously. This also ensures that the db is ready when the command
# of the current container starts.
flock 200
sudo -HEu paperless python3 manage.py migrate
) 200>/usr/src/paperless/data/migration_lock

}

initialize() {
map_uidgid

for data_dir in index media media/documents media/thumbnails; do
if [[ ! -d "../data/$data_dir" ]]
for dir in export data data/index media media/documents media/documents/originals media/documents/thumbnails; do
if [[ ! -d "../$dir" ]]
then
echo "creating directory ../data/$data_dir"
mkdir ../data/$data_dir
echo "creating directory ../$dir"
mkdir ../$dir
fi
done

Expand All @@ -46,7 +45,6 @@ initialize() {
}

install_languages() {
echo "TEST"
local langs="$1"
read -ra langs <<<"$langs"

Expand Down
1 change: 0 additions & 1 deletion src/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class DocumentViewSet(RetrieveModelMixin,
ordering_fields = (
"id", "title", "correspondent__name", "created", "modified", "added", "archive_serial_number")


def file_response(self, pk, disposition):
#TODO: this should not be necessary here.
content_types = {
Expand Down
4 changes: 3 additions & 1 deletion src/paperless/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def paths_check(app_configs, **kwargs):
Check the various paths for existence, readability and writeability
"""

check_messages = path_check("PAPERLESS_DATA_DIR") +\
check_messages = path_check("PAPERLESS_DATA_DIR") + \
path_check("PAPERLESS_MEDIA_ROOT") + \
path_check("PAPERLESS_CONSUMPTION_DIR") + \
path_check("PAPERLESS_STATICDIR")

return check_messages
Expand Down
6 changes: 3 additions & 3 deletions src/paperless/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ def __get_boolean(key, default="NO"):

DATA_DIR = os.getenv('PAPERLESS_DATA_DIR', os.path.join(BASE_DIR, "..", "data"))

MEDIA_ROOT = os.path.join(DATA_DIR, "media")
MEDIA_ROOT = os.getenv('PAPERLESS_MEDIA_ROOT', os.path.join(BASE_DIR, "..", "media"))

INDEX_DIR = os.path.join(DATA_DIR, "index")
ORIGINALS_DIR = os.path.join(MEDIA_ROOT, "documents")
THUMBNAIL_DIR = os.path.join(MEDIA_ROOT, "thumbnails")
ORIGINALS_DIR = os.path.join(MEDIA_ROOT, "documents", "originals")
THUMBNAIL_DIR = os.path.join(MEDIA_ROOT, "documents", "thumbnails")
MODEL_FILE = os.path.join(DATA_DIR, "classification_model.pickle")

# Quick-start development settings - unsuitable for production
Expand Down

0 comments on commit 5c48497

Please sign in to comment.