Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to run Django on my Windows Server 2008 machine.

I can do this manually by calling python 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 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?

share|improve this question
up vote 2 down vote accepted

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 runserver 54321 as the parameters.

share|improve this answer
Running as a different user fixed it. Not sure why Local Service isn't acceptable. Thanks! – Maxim Zaslavsky Mar 5 '14 at 19:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.