settings: Derive RUNNING_INSIDE_TORNADO based on sys.argv.

This allows it to be used at application startup time.
This commit is contained in:
Alex Vandiver
2025-05-02 18:52:33 +00:00
committed by Tim Abbott
parent 8bb0768c4b
commit 169daa31a0
2 changed files with 3 additions and 2 deletions

View File

@@ -12,7 +12,6 @@ from typing_extensions import override
from zerver.lib.management import ZulipBaseCommand from zerver.lib.management import ZulipBaseCommand
settings.RUNNING_INSIDE_TORNADO = True
if settings.PRODUCTION: if settings.PRODUCTION:
settings.SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") settings.SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

View File

@@ -295,7 +295,9 @@ if not TORNADO_PORTS:
TORNADO_PORTS = get_tornado_ports(config_file) TORNADO_PORTS = get_tornado_ports(config_file)
TORNADO_PROCESSES = len(TORNADO_PORTS) TORNADO_PROCESSES = len(TORNADO_PORTS)
RUNNING_INSIDE_TORNADO = False RUNNING_INSIDE_TORNADO = (
len(sys.argv) > 1 and "manage.py" in sys.argv[0] and sys.argv[1] == "runtornado"
)
SILENCED_SYSTEM_CHECKS = [ SILENCED_SYSTEM_CHECKS = [
# auth.W004 checks that the UserProfile field named by USERNAME_FIELD has # auth.W004 checks that the UserProfile field named by USERNAME_FIELD has