Friday, 19 April 2019

Windows: Python Daemon Won't Run on IIS but Runs Locally

I have a Django web application hosted on IIS. I subprocess should be consistently running alongside the web application. When I run the application locally using

 python manage.py runserver 

the background task runs perfectly while the application is running. However, hosted on IIS the background task does not appear to run. How do I make the task run even when hosted on IIS?

In the manage.py file of Django I have the following code:

def run_background():
     return subprocess.Popen(["python", "background.py"], creationflag=subprocess.CREATE_NEW_PROCESS_GROUP)
run_background()
execute_from_command_line(sys.argv)

What can be done to make the background task always run even on IIS?



from Windows: Python Daemon Won't Run on IIS but Runs Locally

No comments:

Post a Comment