Launch multiple honcho files depending on the context

This commit is contained in:
2025-03-04 14:48:44 +01:00
parent 87f790a044
commit 6b27a97e7b
11 changed files with 66 additions and 48 deletions

View File

@ -1,7 +1,13 @@
import atexit
import os
from django.conf import settings
from django.contrib.staticfiles.management.commands.runserver import (
Command as Runserver,
)
from django.utils.autoreload import DJANGO_AUTORELOAD_ENV
from sith.composer import start_composer, stop_composer
from staticfiles.processors import OpenApi
@ -10,4 +16,10 @@ class Command(Runserver):
def run(self, **options):
OpenApi.compile()
if (
os.environ.get(DJANGO_AUTORELOAD_ENV) is None
and settings.PROCFILE_STATIC is not None
):
start_composer(settings.PROCFILE_STATIC)
_ = atexit.register(stop_composer, procfile=settings.PROCFILE_STATIC)
super().run(**options)