Sith/manage.py

39 lines
1.1 KiB
Python
Raw Normal View History

2015-11-18 09:44:06 +01:00
#!/usr/bin/env python3
#
# Copyright 2023 © AE UTBM
# ae@utbm.fr / ae.info@utbm.fr
#
# This file is part of the website of the UTBM Student Association (AE UTBM),
# https://ae.utbm.fr.
#
# You can find the source code of the website at https://github.com/ae-utbm/sith
#
# LICENSED UNDER THE GNU GENERAL PUBLIC LICENSE VERSION 3 (GPLv3)
2024-09-23 10:25:27 +02:00
# SEE : https://raw.githubusercontent.com/ae-utbm/sith/master/LICENSE
# OR WITHIN THE LOCAL FILE "LICENSE"
#
#
import atexit
import logging
2015-11-18 09:44:06 +01:00
import os
import sys
from django.utils.autoreload import DJANGO_AUTORELOAD_ENV
2025-02-20 18:38:15 +01:00
from sith.composer import start_composer, stop_composer
2025-03-04 11:59:35 +01:00
from sith.settings import PROCFILE_FULL, PROCFILE_MINIMAL
2015-11-18 09:44:06 +01:00
if __name__ == "__main__":
logging.basicConfig(encoding="utf-8", level=logging.INFO)
2015-11-18 09:44:06 +01:00
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sith.settings")
from django.core.management import execute_from_command_line
2025-03-04 11:59:35 +01:00
procfile = PROCFILE_FULL if sys.argv[1] == "runserver" else PROCFILE_MINIMAL
if os.environ.get(DJANGO_AUTORELOAD_ENV) is None and procfile is not None:
start_composer(procfile)
_ = atexit.register(stop_composer)
2015-11-18 09:44:06 +01:00
execute_from_command_line(sys.argv)