chore: add serve command
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
|
||||
|
||||
application = get_asgi_application()
|
||||
@@ -0,0 +1,19 @@
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def serve() -> None:
|
||||
"""Start the Daphne ASGI server on 0.0.0.0:8080."""
|
||||
daphne_path = str(Path(sys.path[0]) / "daphne")
|
||||
subprocess.run( # noqa: S603
|
||||
[
|
||||
daphne_path,
|
||||
"-b",
|
||||
"0.0.0.0", # noqa: S104
|
||||
"-p",
|
||||
"8080",
|
||||
"app.routing:application",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
Reference in New Issue
Block a user