Skip to content

Commit

Permalink
Create launch_site.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JusticeV452 committed Jun 26, 2024
1 parent f7db0d0 commit 261b214
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions backend/app/management/commands/launch_site.py
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()

0 comments on commit 261b214

Please sign in to comment.