mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-15 10:43:22 +00:00
d16a207a83
* ruff: apply rule F * ruff: apply rule E * ruff: apply rule SIM * ruff: apply rule TCH * ruff: apply rule ERA * ruff: apply rule PLW * ruff: apply rule FLY * ruff: apply rule PERF * ruff: apply rules FURB & RUF
25 lines
821 B
Python
25 lines
821 B
Python
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 staticfiles.processors import OpenApi, Webpack
|
|
|
|
|
|
class Command(Runserver):
|
|
"""Light wrapper around default runserver that integrates webpack auto bundling."""
|
|
|
|
def run(self, **options):
|
|
# OpenApi generation needs to be before webpack
|
|
OpenApi.compile()
|
|
# Only run webpack server when debug is enabled
|
|
# Also protects from re-launching the server if django reloads it
|
|
if os.environ.get(DJANGO_AUTORELOAD_ENV) is None and settings.DEBUG:
|
|
with Webpack.runserver():
|
|
super().run(**options)
|
|
return
|
|
super().run(**options)
|