diff --git a/docs/installation.rst b/docs/installation.rst index 09d3ea1e8e18be7af4f8e6da4575971b9bb1ceff..f88745eb9c1d40202471ba87f31cf2a3a2ce473c 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -150,10 +150,12 @@ Configuration ------------- Configuration and runtime data is stored in the instance directory. For -container installs, this is ``/usr/local/var/schilder2000-instance/``. -For package installs, this is ``{{ python prefix }}/var/schilder2000-instance``; -if in doubt, try to run ``flask -A schilder2000``, the error should tell you -where it expects the instance directory. +container installs, this is ``/usr/local/var/schilder2000-instance/``. For +package installs, this defaults to ``{{ python prefix +}}/var/schilder2000-instance``; if in doubt, try to run ``flask -A +schilder2000``, the error should tell you where it expects the instance +directory. To override, specify an *absolute* path in the +``SCHILDER2000_INSTANCE_PATH`` environment variable. Example config and data is located in the ``examples`` directory. The templates there get their footer text and logo from the application config and should also diff --git a/schilder2000/__init__.py b/schilder2000/__init__.py index ebbb813e9eead902e53e7d6f120d8b35a3abc019..0d3a4a21a04563e158a88ea8b0d0720a0792f0e7 100644 --- a/schilder2000/__init__.py +++ b/schilder2000/__init__.py @@ -1,3 +1,4 @@ +import os from pathlib import Path from flask_multipass import Multipass @@ -15,7 +16,11 @@ multipass = Multipass() def create_app(): - app = Flask(__name__, instance_relative_config=True) + app = Flask( + __name__, + instance_path=os.getenv("SCHILDER2000_INSTANCE_PATH"), + instance_relative_config=True, + ) app.config.from_pyfile("config/config.py") app.cli.add_command(cli.alembic)