mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
manage.py: Revert sabotaging pika.adapters.twisted_connection import.
This reverts commit ec9f6702d8
.
Now that pika 0.13.0 has merged our PR to not import twisted unless it
is needed, we don't need to use this performance hack in order to
avoid wasting time importing twisted and all its dependencies.
This commit is contained in:
10
manage.py
10
manage.py
@@ -2,7 +2,6 @@
|
||||
from __future__ import (print_function)
|
||||
import os
|
||||
import sys
|
||||
import types
|
||||
import configparser
|
||||
if sys.version_info <= (3, 0):
|
||||
print("Error: Zulip is a Python 3 project, and cannot be run with Python 2.")
|
||||
@@ -32,15 +31,6 @@ if __name__ == "__main__":
|
||||
print("Error accessing Zulip secrets; manage.py in production must be run as the zulip user.")
|
||||
sys.exit(1)
|
||||
|
||||
# Performance Hack: We make the pika.adapters.twisted_connection
|
||||
# module unavailable, to save ~100ms of import time for most Zulip
|
||||
# management commands for code we don't use. The correct
|
||||
# long-term fix for this will be to get a setting integrated
|
||||
# upstream to disable pika importing this.
|
||||
# See https://github.com/pika/pika/issues/1128
|
||||
sys.modules['pika.adapters.twisted_connection'] = types.ModuleType(
|
||||
'pika.adapters.twisted_connection')
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings")
|
||||
from django.conf import settings
|
||||
from django.core.management import execute_from_command_line
|
||||
|
@@ -15,21 +15,11 @@ framework.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import types
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.append(BASE_DIR)
|
||||
import scripts.lib.setup_path_on_import
|
||||
|
||||
# Performance Hack: We make the pika.adapters.twisted_connection
|
||||
# module unavailable, to save ~100ms of import time for most Zulip
|
||||
# management commands for code we don't use. The correct
|
||||
# long-term fix for this will be to get a setting integrated
|
||||
# upstream to disable pika importing this.
|
||||
# See https://github.com/pika/pika/issues/1128
|
||||
sys.modules['pika.adapters.twisted_connection'] = types.ModuleType(
|
||||
'pika.adapters.twisted_connection')
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings")
|
||||
import django
|
||||
django.setup() # We need to call setup to load applications.
|
||||
|
Reference in New Issue
Block a user