Reputation: 1
I am developing a backend site using django framework.
And followed instructions in django's documentation,
I used Uvicorn as ASGI server for hosting django apps,
it worked properly when I executed the command below.
uvicorn "djangoapp.asgi:application"
But when I tried installing it as a Windows Service and started it from service manager,
uvicorn ended without prompting any messages.
I tried this:
nssm install djangoapp
In settings window, I set the parameters as below
executable: pwsh.exe
working directory: D:\djangoapp
arguments: -ep ByPass -noe -f service.ps1
in which the directory "D:\djangoapp" holds everything I coded for my backend site,
and the contents of "service.ps1" are just like below:
(Get-Command python).Source >> output.log
(Get-Command uvicorn).Source >> output.log
$PWD.Path >> output.log
uvicorn "djangoapp.asgi:application" >> output.log
"uvicorn ended" >> output.log
After starting this service, I checked processes in task manager,
there is no process of which command line contains "uvicorn".
And in "output.log", there are only 3 lines of messages as below
xxxx\xx\xx\python3.exe
xxxx\xx\xx\xxx\script\uvicorn.exe
D:\djangoapp
Although I can't find any process related to uvicorn existing,
(meaning it exited or not started,)
the last line of message, "uvicorn ended", that I expected to be output,
didn't appear in the log.
I have tried using Hypercorn instead, but got the same result. Don't know which part I have missing.
I have followed the almost same steps to install Open-WebUI as a windows service and it worked properly.
So I think this should work...
Is there anybody who has the same trouble ever and got it resovled?
If so, would you please share your solutions?
Or, any ideas on how to resovle are greatly appreciated.
Thank you in advance.
Best regards,
Bill
Upvotes: 0
Views: 111