From acd6c51b6fb869ca0870af058eb86b54410ad14c Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 11 Jun 2025 16:31:16 -0700 Subject: [PATCH] manage: Delete custom PYTHONSTARTUP. In Django 5.2, manage.py shell automatically imports models. Signed-off-by: Anders Kaseorg --- manage.py | 1 - scripts/lib/pythonrc.py | 18 ------------------ 2 files changed, 19 deletions(-) delete mode 100644 scripts/lib/pythonrc.py diff --git a/manage.py b/manage.py index 9143ad61a0..4d626d0889 100755 --- a/manage.py +++ b/manage.py @@ -148,7 +148,6 @@ if __name__ == "__main__": log_management_command(sys.argv, settings.MANAGEMENT_LOG_PATH) - os.environ.setdefault("PYTHONSTARTUP", os.path.join(BASE_DIR, "scripts/lib/pythonrc.py")) if "--no-traceback" not in sys.argv and len(sys.argv) > 1: sys.argv.append("--traceback") try: diff --git a/scripts/lib/pythonrc.py b/scripts/lib/pythonrc.py deleted file mode 100644 index f078c44fa0..0000000000 --- a/scripts/lib/pythonrc.py +++ /dev/null @@ -1,18 +0,0 @@ -try: - from django.conf import settings - - from analytics.models import * # noqa: F403 - from zerver.models import * # noqa: F403 - from zerver.models.realms import * # noqa: F403 - from zerver.models.streams import * # noqa: F403 - from zerver.models.users import * # noqa: F403 - - if settings.CORPORATE_ENABLED: - from corporate.lib.stripe import * # noqa: F403 -except Exception: - import traceback - - print("\nException importing Zulip core modules on startup!") - traceback.print_exc() -else: - print("\nSuccessfully imported Zulip settings, models, and actions functions.")