From: Sblop <17447438+Sblop@users.noreply.github.com> Date: Fri, 28 Oct 2022 13:41:23 +0000 (+0200) Subject: Update settings.py X-Git-Tag: v1.10.0-beta.rc1~1^2~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c414de9c35d4ec0b6d495a35432d0402067ca89c;p=thirdparty%2Fpaperless-ngx.git Update settings.py Django gives a system error on MariaDB on VARCHARs longer than 255 chars. This was a limitation in older versions of mysql. Meaning: You cannot run Paperless-NGX on older version were this limitation were present, meaning Django plays it extremely safe by giving an error. This fixes this problem. --- diff --git a/src/paperless/settings.py b/src/paperless/settings.py index 1fb6ba9131..358535e87d 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -347,6 +347,11 @@ if os.getenv("PAPERLESS_DBHOST"): if os.getenv("PAPERLESS_DBENGINE") == "mariadb": engine = "django.db.backends.mysql" options = {"read_default_file": "/etc/mysql/my.cnf", "charset": "utf8mb4"} + #Silence Django erros on old MariaDB versions where VARCHAR were limited to 255 chars. + #https://docs.djangoproject.com/en/4.1/ref/checks/#database + #https://mariadb.com/kb/en/innodb-system-variables/#innodb_large_prefix + SILENCED_SYSTEM_CHECKS = ["mysql.W003"] + else: # Default to PostgresDB engine = "django.db.backends.postgresql_psycopg2" options = {"sslmode": os.getenv("PAPERLESS_DBSSLMODE", "prefer")}