-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7db0d0
commit 261b214
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Django management command launch_site | ||
""" | ||
|
||
import platform | ||
import subprocess | ||
|
||
from django.core.management.base import BaseCommand | ||
from django.core.management import call_command | ||
|
||
|
||
class Command(BaseCommand): | ||
""" | ||
Custom django-admin command to launch the local website | ||
""" | ||
|
||
help = "Custom django-admin command to launch the local website" | ||
|
||
def handle(self, *args, **options): | ||
on_windows = platform.system() == "Windows" | ||
frontend_cmd = [f"npm{'.cmd' if on_windows else ''}", "run", "start"] | ||
with subprocess.Popen(frontend_cmd) as frontend: | ||
call_command("runserver") | ||
frontend.kill() |