0 votes
1 view
in Python by (28.1k points)

I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher-level interface for operations on these objects, and the other programs to access the objects through that service.

I am currently aiming for Python and the Django framework as the technologies to implement that service with. I'm pretty sure I figure how to daemonize the Python program in Linux. However, it is an optional spec item that the system should support Windows. I have little experience with Windows programming and no experience at all with Windows services.

Is it possible to run a Python program as a Windows service (i. e. run it automatically without user login)? I won't necessarily have to implement this part, but I need a rough idea of how it would be done in order to decide whether to design along these lines.

1 Answer

0 votes
by (68.3k points)

To run a Python script as a service in Windows you can do it using the pythoncom libraries that come included with ActivePython or can be installed with pywin32.

The code that you will write would go in the main() method—usually with some kind of infinite loop that might be interrupted by checking a flag, which you set in the SvcStop method

...