简体   繁体   中英

How to run flask framework scripts build in python 3.6.4 as a windows service

I am currently trying for a python script written in Flask framework to implement and run as a windows service.

Have tried using different solutions like as below link: http://www.chrisumbel.com/article/windows_services_in_python

But getting same windows error:

D:\>python PySvc.py start
Starting service PySvc
Error starting service: The service did not respond to the start or control 
request in a timely fashion.

Kindly assist me, as i am not able to proceed on this.

Depending on what your requirements are, I think you should have a look at NSSM , it is a great tool to run python scripts as a service on Windows.

You can set up NSSM like this:

nssm.exe install MyPythonScriptService

Then, a dialogbox will pop up: Dialog Box

There are 3 fields that you need to fill in:

Application Path: C:\Python32\python.exe
Startup Directory: C:\Path\To\My\Python\Script\
Arguments: C:\Path\To\My\Python\Script\script.py

And then, hit Install service. Go to services.msc and make sure your service is up and running.

Check out this question as well And this video

Hope It helps you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM