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 -- 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?

1 Answer 1


I would try running it as a different user to see if that is the issue. Also, you can try not using a batch file. Instead, set the location to python and use manage.py runserver 54321 as the parameters.

  • Running as a different user fixed it. Not sure why Local Service isn't acceptable. Thanks! Commented Mar 5, 2014 at 19:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .