Reputation: 715
I have a Django web application hosted on IIS. I subprocess should ALWAYS BE 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)
I do not know how to resolve this issue.
Would something like Celery work to indefinitely run a task? How would I do this? Please give step by step instructions.
Upvotes: 1
Views: 1061
Reputation: 12789
You could set appplication set to auto-start by following below steps:
Select Application pool->advance setting->start mode=”always running”, Under the Process Model section, set the Idle Time-out (minutes) option to 0 and Under the Recycling section, set the Regular Time Interval (minutes) option to 0
Also, check that you set FastCGI setting:
Regards, Jalpa.
Upvotes: 1