Code owners
Assign users and groups as approvers for specific file changes. Learn more.
manage.py 1.15 KiB
#!/usr/bin/env python3
import os
import sys
import signal
def subscribe_to_signals():
# raise SignalException when a signal is caught so django will exit gracefully
class SignalException(Exception):
pass
def signal_handler(_s, _f):
raise SignalException("signal %s received..." % (_s,))
for s in [signal.SIGHUP, signal.SIGINT]:
signal.signal(s, signal_handler)
if __name__ == "__main__":
# do subscribe to more signals than django does for proper exits during testing
if os.environ.get('TMSS_RAISE_ON_SIGNALS', "False").lower() in ["true", "1", "on"]:
subscribe_to_signals()
# normal django startup. Specify the DJANGO_SETTINGS_MODULE, and run it.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tmss.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)