I’m serving a Django app behind IIS 6. I’m wondering if I can restart IIS 6 within Python/Django and what one of the best ways to do would be.
Help would be great!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Besides what’s already suggested, you can also use WMI via either the Win32_Service or the IIsWebService class, which inherits from it. There is a Python WMI wrapper available, which is based on pywin32.
UPDATE: A quick test of the following worked for me.
I didn’t test the next piece of code, but something like this should also work:
You can see the documentation for the return values from the StopService and StartService methods.