fixed folders, compatible with previous paperless version

This commit is contained in:
Jonas Winkler 2020-10-29 14:30:15 +01:00
parent 024c28a34a
commit 5c4849796b
10 changed files with 27 additions and 23 deletions

5
.gitignore vendored
View File

@ -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

View File

@ -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/*

View File

View File

@ -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"

View File

@ -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
@ -46,7 +45,6 @@ initialize() {
}
install_languages() {
echo "TEST"
local langs="$1"
read -ra langs <<<"$langs"

View File

@ -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 = {

View File

@ -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

View File

@ -39,11 +39,11 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
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