Skip to content

Commit

Permalink
Added launch_site management command
Browse files Browse the repository at this point in the history
  • Loading branch information
JusticeV452 committed Apr 24, 2024
1 parent dca8794 commit 8cc1abd
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"]
frontend = subprocess.Popen(frontend_cmd)
call_command("runserver")
frontend.kill()

0 comments on commit 8cc1abd

Please sign in to comment.