0

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?

1 Answer 1

2

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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