From 8dc49b635913bcb0c103226a3d99c0abda53c8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 21 Jan 2026 19:12:34 +0100 Subject: [PATCH] Add environment variable to enable development mode Closes #14530 (grafted from b251595fa8aa5524ec888bc384743da3bb3b7a5d) --HG-- branch : 7.0 --- trytond/doc/topics/start_server.rst | 1 + trytond/trytond/commandline.py | 1 + trytond/trytond/wsgi.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/trytond/doc/topics/start_server.rst b/trytond/doc/topics/start_server.rst index b847612e78..d5d2e751e5 100644 --- a/trytond/doc/topics/start_server.rst +++ b/trytond/doc/topics/start_server.rst @@ -43,6 +43,7 @@ Following environment variables can be set: * ``TRYTOND_COROUTINE``: Use coroutine for concurrency. * ``TRYTOND_DATABASE_NAMES``: A list of database names in CSV format, using python default dialect. + * ``TRYTOND_DEV``: A boolean to enable development mode. .. warning:: You must manage to serve the static files from the web root. diff --git a/trytond/trytond/commandline.py b/trytond/trytond/commandline.py index fd467b3431..cc71130d8d 100644 --- a/trytond/trytond/commandline.py +++ b/trytond/trytond/commandline.py @@ -50,6 +50,7 @@ def get_parser(): parser.add_argument("-v", "--verbose", action='count', dest="verbose", default=0, help="enable verbose mode") parser.add_argument('--dev', dest='dev', action='store_true', + default=bool(int(os.getenv('TRYTOND_DEV', 0))), help='enable development mode') logging_config = os.environ.get('TRYTOND_LOGGING_CONFIG') diff --git a/trytond/trytond/wsgi.py b/trytond/trytond/wsgi.py index 9368ebcd07..8b82d7a184 100644 --- a/trytond/trytond/wsgi.py +++ b/trytond/trytond/wsgi.py @@ -56,7 +56,7 @@ class TrytondWSGI(object): }) self.protocols = [JSONProtocol, XMLProtocol] self.error_handlers = [] - self.dev = False + self.dev = bool(int(os.getenv('TRYTOND_DEV', 0))) def route(self, string, methods=None, defaults=None): def decorator(func):