I'm trying to run Django on my Windows Server 2008 machine.
I can do this manually by calling
python manage.py runserver 54321, which launches Django's server at
http://127.0.0.1:54321 -- then I can use reverse proxy in IIS to feed the site through IIS.
But now, I want to automate this server launch so that it happens as soon as the server boots up. I'm using Scheduled Tasks to accomplish this. I have a file named
launch.cmd which contains
python manage.py runserver 54321 &, and then a scheduled task running under Local Service that runs
launch.cmd at startup.
When I run the Scheduled Task to test it, it stops immediately with run result (0x1). Per the task history, this suggests that the script is being run and then ended immediately, meaning the Django server isn't around to serve content.
Is there a way to prevent my Scheduled Task from ending immediately after I launch my Django server?