Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d2b71454d | ||
|
|
5cbb33b02b | ||
|
|
2c55aad6c0 | ||
|
|
1e039dcb32 | ||
|
|
6ca8da4858 | ||
|
|
82f05e27c3 | ||
|
|
7a627e4ad8 | ||
|
|
73af9552ec | ||
|
|
e4854f2144 | ||
|
|
6f5c1ac4e1 | ||
|
|
22acc51284 | ||
|
|
a05644fc31 | ||
|
|
d1aa54caa9 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -68,6 +68,7 @@ db.sqlite3
|
|||||||
.idea
|
.idea
|
||||||
|
|
||||||
# Other stuff that doesn't belong
|
# Other stuff that doesn't belong
|
||||||
|
.virtualenv
|
||||||
virtualenv
|
virtualenv
|
||||||
.vagrant
|
.vagrant
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
|
|||||||
@@ -575,3 +575,28 @@ If you're using Docker, you can set a restart-policy_ in the
|
|||||||
Docker daemon.
|
Docker daemon.
|
||||||
|
|
||||||
.. _restart-policy: https://docs.docker.com/engine/reference/commandline/run/#restart-policies-restart
|
.. _restart-policy: https://docs.docker.com/engine/reference/commandline/run/#restart-policies-restart
|
||||||
|
|
||||||
|
|
||||||
|
.. _setup-subdirectory
|
||||||
|
|
||||||
|
Hosting Paperless in a Subdirectory
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
Paperless was designed to run off the root of the hosting domain,
|
||||||
|
(ie: ``https://example.com/``) but with a few changes, you can configure
|
||||||
|
it to run in a subdirectory on your server
|
||||||
|
(ie: ``https://example.com/paperless/``).
|
||||||
|
|
||||||
|
Thanks to the efforts of `maphy-psd`_ on `Github`_, running Paperless in a
|
||||||
|
subdirectory is now as easy as setting a config variable. Simply set
|
||||||
|
``PAPERLESS_FORCE_SCRIPT_NAME`` in your environment or
|
||||||
|
``/etc/paperless.conf`` to the path you want Paperless hosted at, configure
|
||||||
|
Nginx/Apache for your needs and you're done. So, if you want Paperless to live
|
||||||
|
at ``https://example.com/arbitrary/path/to/paperless`` then you just set
|
||||||
|
``PAPERLESS_FORCE_SCRIPT_NAME`` to ``/arbitrary/path/to/paperless``. Note the
|
||||||
|
leading ``/`` there.
|
||||||
|
|
||||||
|
As to how to configure Nginx or Apache for this, that's on you :-)
|
||||||
|
|
||||||
|
.. _maphy-psd: https://github.com/maphy-psd
|
||||||
|
.. _Github: https://github.com/danielquinn/paperless/pull/255
|
||||||
|
|||||||
@@ -80,6 +80,11 @@ PAPERLESS_PASSPHRASE="secret"
|
|||||||
# as is "example.com,www.example.com", but NOT " example.com" or "example.com,"
|
# as is "example.com,www.example.com", but NOT " example.com" or "example.com,"
|
||||||
#PAPERLESS_ALLOWED_HOSTS="example.com,www.example.com"
|
#PAPERLESS_ALLOWED_HOSTS="example.com,www.example.com"
|
||||||
|
|
||||||
|
# To host paperless under a subpath url like example.com/paperless you set
|
||||||
|
# this value to /paperless. No trailing slash!
|
||||||
|
#
|
||||||
|
# https://docs.djangoproject.com/en/1.11/ref/settings/#force-script-name
|
||||||
|
#PAPERLESS_FORCE_SCRIPT_NAME=""
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#### Software Tweaks ####
|
#### Software Tweaks ####
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Django==1.10.5
|
Django>=1.10,<1.11
|
||||||
Pillow>=3.1.1
|
Pillow>=3.1.1
|
||||||
django-crispy-forms>=1.6.1
|
django-crispy-forms>=1.6.1
|
||||||
django-extensions>=1.7.6
|
django-extensions>=1.7.6
|
||||||
@@ -13,7 +13,7 @@ python-dateutil>=2.6.0
|
|||||||
python-dotenv>=0.6.2
|
python-dotenv>=0.6.2
|
||||||
python-gnupg>=0.3.9
|
python-gnupg>=0.3.9
|
||||||
pytz>=2016.10
|
pytz>=2016.10
|
||||||
gunicorn==19.6.0
|
gunicorn==19.7.1
|
||||||
|
|
||||||
# For the tests
|
# For the tests
|
||||||
factory-boy
|
factory-boy
|
||||||
|
|||||||
@@ -70,9 +70,14 @@ class DocumentAdmin(CommonAdmin):
|
|||||||
created_.short_description = "Created"
|
created_.short_description = "Created"
|
||||||
|
|
||||||
def thumbnail(self, obj):
|
def thumbnail(self, obj):
|
||||||
|
if settings.FORCE_SCRIPT_NAME:
|
||||||
|
src_link = "{}/fetch/thumb/{}".format(
|
||||||
|
settings.FORCE_SCRIPT_NAME, obj.id)
|
||||||
|
else:
|
||||||
|
src_link = "/fetch/thumb/{}".format(obj.id)
|
||||||
png_img = self._html_tag(
|
png_img = self._html_tag(
|
||||||
"img",
|
"img",
|
||||||
src="/fetch/thumb/{}".format(obj.id),
|
src=src_link,
|
||||||
width=180,
|
width=180,
|
||||||
alt="Thumbnail of {}".format(obj.file_name),
|
alt="Thumbnail of {}".format(obj.file_name),
|
||||||
title=obj.file_name
|
title=obj.file_name
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ class GnuPG(object):
|
|||||||
|
|
||||||
def move_documents_and_create_thumbnails(apps, schema_editor):
|
def move_documents_and_create_thumbnails(apps, schema_editor):
|
||||||
|
|
||||||
|
os.makedirs(os.path.join(settings.MEDIA_ROOT, "documents", "originals"), exist_ok=True)
|
||||||
|
os.makedirs(os.path.join(settings.MEDIA_ROOT, "documents", "thumbnails"), exist_ok=True)
|
||||||
|
|
||||||
documents = os.listdir(os.path.join(settings.MEDIA_ROOT, "documents"))
|
documents = os.listdir(os.path.join(settings.MEDIA_ROOT, "documents"))
|
||||||
|
|
||||||
if set(documents) == {"originals", "thumbnails"}:
|
if set(documents) == {"originals", "thumbnails"}:
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ _allowed_hosts = os.getenv("PAPERLESS_ALLOWED_HOSTS")
|
|||||||
if _allowed_hosts:
|
if _allowed_hosts:
|
||||||
ALLOWED_HOSTS = _allowed_hosts.split(",")
|
ALLOWED_HOSTS = _allowed_hosts.split(",")
|
||||||
|
|
||||||
|
FORCE_SCRIPT_NAME = os.getenv("PAPERLESS_FORCE_SCRIPT_NAME")
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user