mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-18 20:46:49 +01:00
parent
d7d9c1edc0
commit
75884285cf
2 changed files with 26 additions and 1 deletions
|
|
@ -1 +1 @@
|
||||||
from .checks import paths_check
|
from .checks import paths_check, binaries_check
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.core.checks import Error, register, Warning
|
from django.core.checks import Error, register, Warning
|
||||||
|
|
||||||
|
|
||||||
@register()
|
@register()
|
||||||
def paths_check(app_configs, **kwargs):
|
def paths_check(app_configs, **kwargs):
|
||||||
|
"""
|
||||||
|
Check the various paths for existence, readability and writeability
|
||||||
|
"""
|
||||||
|
|
||||||
check_messages = []
|
check_messages = []
|
||||||
|
|
||||||
|
|
@ -45,3 +50,23 @@ def paths_check(app_configs, **kwargs):
|
||||||
))
|
))
|
||||||
|
|
||||||
return check_messages
|
return check_messages
|
||||||
|
|
||||||
|
|
||||||
|
@register()
|
||||||
|
def binaries_check(app_configs, **kwargs):
|
||||||
|
"""
|
||||||
|
Paperless requires the existence of a few binaries, so we do some checks
|
||||||
|
for those here.
|
||||||
|
"""
|
||||||
|
|
||||||
|
error = "Paperless can't find {}. Without it, consumption is impossible."
|
||||||
|
hint = "Either it's not in your ${PATH} or it's not installed."
|
||||||
|
|
||||||
|
binaries = (settings.CONVERT_BINARY, settings.UNPAPER_BINARY, "tesseract")
|
||||||
|
|
||||||
|
check_messages = []
|
||||||
|
for binary in binaries:
|
||||||
|
if shutil.which(binary) is None:
|
||||||
|
check_messages.append(Warning(error.format(binary), hint))
|
||||||
|
|
||||||
|
return check_messages
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue