mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Sli
655d72a2b1
* Migrate alpine * Migrate jquery and jquery-ui * Migrate shorten * Add babel for javascript * Introduce staticfiles django app * Only bundle -index.js files in static/webpack * Unify scss and webpack generated files * Convert scss calls to static * Add --clear-generated option to collectstatic * Fix docs warnings
23 lines
733 B
Python
23 lines
733 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 Webpack
|
|
|
|
|
|
class Command(Runserver):
|
|
"""Light wrapper around the statics runserver that integrates webpack auto bundling"""
|
|
|
|
def run(self, **options):
|
|
# 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)
|