Windows production mode command (#570)
This commit is contained in:
parent
977cc6990f
commit
f7a5c99969
@ -77,6 +77,7 @@ BACKEND_HOST = "0.0.0.0"
|
||||
TIMEOUT = 120
|
||||
# The command to run the backend in production mode.
|
||||
RUN_BACKEND_PROD = f"gunicorn --worker-class uvicorn.workers.UvicornH11Worker --preload --timeout {TIMEOUT} --log-level critical".split()
|
||||
RUN_BACKEND_PROD_WINDOWS = f"uvicorn --timeout-keep-alive {TIMEOUT}".split()
|
||||
|
||||
# Compiler variables.
|
||||
# The extension for compiled Javascript files.
|
||||
|
@ -799,16 +799,33 @@ def run_backend_prod(
|
||||
setup_backend()
|
||||
|
||||
num_workers = get_num_workers()
|
||||
command = constants.RUN_BACKEND_PROD + [
|
||||
"--bind",
|
||||
f"0.0.0.0:{port}",
|
||||
command = (
|
||||
constants.RUN_BACKEND_PROD_WINDOWS
|
||||
+ [
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
str(port),
|
||||
"--log-level",
|
||||
loglevel,
|
||||
f"{app_name}:{constants.APP_VAR}",
|
||||
]
|
||||
if platform.system() == "Windows"
|
||||
else constants.RUN_BACKEND_PROD
|
||||
+ [
|
||||
"--bind",
|
||||
f"0.0.0.0:{port}",
|
||||
"--threads",
|
||||
str(num_workers),
|
||||
"--log-level",
|
||||
str(loglevel),
|
||||
f"{app_name}:{constants.APP_VAR}()",
|
||||
]
|
||||
)
|
||||
|
||||
command += [
|
||||
"--workers",
|
||||
str(num_workers),
|
||||
"--threads",
|
||||
str(num_workers),
|
||||
"--log-level",
|
||||
str(loglevel),
|
||||
f"{app_name}:{constants.APP_VAR}()",
|
||||
]
|
||||
subprocess.run(command)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user