Django waitress- How to run it in Daemon Mode
I've a django application with python package waitress to serve it. But I want the django application to run in daemon mode is it possible? Any help regarding this would be great thanks in advance.
Daemon mode - app running without command prompt visible also I'll be helpful to open shell without even closing the server.
Just add & at the end of command
Start-Process python -NoNewWindow -ArgumentList "manage.py" "runserver"
You can close the terminal after that and it still runs.
If you later want to stop, you have to do with Get-Process and then TaskKill
Another solution - to use Docker, and in your docker you can use gunicorn or any other linux feature
It is possible to run a Django application in daemon mode on a Windows server using the built-in Windows Services feature. Here are the steps to do this:
- Open the Command Prompt as an administrator.
- Navigate to the directory where your Django application is located.
- Use the following command to install the application as a Windows service:
python manage.py installservice
Use the following command to start the service:
net start <service name>
Where is the name of the service that was installed in step 3.
Once the service is started, it will run in the background as a daemon and will continue to run even if the command prompt is closed or the user logs out.
To make the service start automatically whenever the system is restarted, you can use the following command:
sc config <service name> start=auto
Where is the name of the service that was installed in step 3.
To open a shell for the Django application without stopping the service, you can use the following command:
python manage.py shell
This will open a Python shell with access to the Django application, allowing you to run commands and interact with the application.