mirror of
https://github.com/netinvent/npbackup.git
synced 2025-09-10 15:04:55 +08:00
Make sure we always run uvicorn on Windows
This commit is contained in:
parent
258f9fe44e
commit
d0e8d73e22
1 changed files with 6 additions and 3 deletions
|
@ -60,7 +60,11 @@ if __name__ == "__main__":
|
||||||
except (TypeError, KeyError):
|
except (TypeError, KeyError):
|
||||||
port = None
|
port = None
|
||||||
|
|
||||||
if _DEV:
|
|
||||||
|
logger = logger_get_logger()
|
||||||
|
# Cannot run gunicorn on Windows
|
||||||
|
if _DEV or os.name == 'nt':
|
||||||
|
logger.info("Running dev version")
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
server_args = {
|
server_args = {
|
||||||
|
@ -101,9 +105,8 @@ if __name__ == "__main__":
|
||||||
"worker_class": "uvicorn.workers.UvicornWorker",
|
"worker_class": "uvicorn.workers.UvicornWorker",
|
||||||
}
|
}
|
||||||
|
|
||||||
logger = logger_get_logger()
|
|
||||||
try:
|
try:
|
||||||
if _DEV:
|
if _DEV or os.name == 'nt':
|
||||||
uvicorn.run("upgrade_server.api:app", **server_args)
|
uvicorn.run("upgrade_server.api:app", **server_args)
|
||||||
else:
|
else:
|
||||||
StandaloneApplication(upgrade_server.api.app, server_args).run()
|
StandaloneApplication(upgrade_server.api.app, server_args).run()
|
||||||
|
|
Loading…
Add table
Reference in a new issue