| Start |
|---|
| A Python script that can be run as a service The modules used in this example are part of pywin32 (opens new window) (Python for Windows extensions). Depending on how you installed Python, you might need to install this separately. This is just boilerplate. Your application code, probably invoking a separate script, would go in the main() function. You will also need to install this as a service. The best solution for this at the moment appears to be to use Non-sucking Service Manager (opens new window). This allows you to install a service and provides a GUI for configuring the command line the service executes. For Python you can do this, which creates the service in one go: Where my_script.py is the boilerplate script above, modified to invoke your application script or code in the main() function. Note that the service doesn't run the Python script directly, it runs the Python interpreter and passes it the main script on the command line. Alternatively you can use tools provided in the Windows Server Resource Kit for your operating system version so create the service. |
| Running a Flask web application as a service This is a variation on the generic example. You just need to import your app script and invoke it's Adapted from http://stackoverflow.com/a/25130524/318488 (opens new window) |
Read Article
https://develop.horje.com/learn/1434/reference