fix: daphne with root-path
This commit is contained in:
parent
cbce88f039
commit
bf65dc8be0
@ -2,18 +2,23 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from app.config import settings as env
|
||||||
|
|
||||||
|
|
||||||
def serve() -> None:
|
def serve() -> None:
|
||||||
"""Start the Daphne ASGI server on 0.0.0.0:8080."""
|
"""Start the Daphne ASGI server on 0.0.0.0:8080."""
|
||||||
daphne_path = str(Path(sys.path[0]) / "daphne")
|
daphne_path = str(Path(sys.path[0]) / "daphne")
|
||||||
subprocess.run( # noqa: S603
|
args = [
|
||||||
[
|
|
||||||
daphne_path,
|
daphne_path,
|
||||||
"-b",
|
"-b",
|
||||||
"0.0.0.0", # noqa: S104
|
"0.0.0.0", # noqa: S104
|
||||||
"-p",
|
"-p",
|
||||||
"8080",
|
"8080",
|
||||||
"app.routing:application",
|
]
|
||||||
],
|
# FORCE_SCRIPT_NAME is a WSGI-only setting; under ASGI Django derives the URL
|
||||||
check=True,
|
# script prefix from the scope's root_path. Pass the prefix to Daphne so that
|
||||||
)
|
# reverse()/redirects (e.g. the admin post-login redirect) include it.
|
||||||
|
if env.force_script_name:
|
||||||
|
args += ["--root-path", env.force_script_name.rstrip("/")]
|
||||||
|
args.append("app.routing:application")
|
||||||
|
subprocess.run(args, check=True) # noqa: S603
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user