0
我manged讓我(瓶)的應用程序與CherryPy的是這樣的WSGI服務器上運行:Cherrypy as windows service。找不到路徑
from mypyapp import app
import cherrypy
if __name__ == '__main__':
cherrypy.tree.graft(app, "/")
cherrypy.config.update({
'log.screen': True,
'server.socket_port': 8888,
})
cherrypy.engine.start()
cherrypy.engine.block()
現在我想將它安裝爲Windows服務,我遇到的問題。下面的代碼: 進口的CherryPy 從mypyapp導入應用
class PyWebService(win32serviceutil.ServiceFramework):
""" Py Web Service """
def SvcDoRun(self):
cherrypy.tree.mount(app, "/")
cherrypy.config.update({
'global': {
'engine.autoreload.on': False,
'log.screen': False,
'log.error_file': 'c:\\Temp\\error.log',
'engine.SIGHUP': None,
'engine.SIGTERM': None,
'server.socket_port': 8888,
}
})
cherrypy.engine.start()
cherrypy.engine.block()
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
cherrypy.engine.exit()
self.ReportServiceStatus(win32service.SERVICE_STOPPED)
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(ConcertWebService)
我可以安裝和運行服務,並在日誌中表明它是沒有任何問題運行輸出。但是,當我嘗試用瀏覽器訪問服務器,我得到404
404 Not Found
The path '/' was not found.
Traceback (most recent call last):
File "C:\Users\viktor.forsman\IdeaProjects\cfas\venv\lib\site-packages\cherrypy\_cprequest.py", line 670, in respond
response.body = self.handler()
File "C:\Users\viktor.forsman\IdeaProjects\cfas\venv\lib\site-packages\cherrypy\lib\encoding.py", line 217, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "C:\Users\viktor.forsman\IdeaProjects\cfas\venv\lib\site-packages\cherrypy\_cperror.py", line 411, in __call__
raise self
NotFound: (404, "The path '/' was not found.")
我無法理解的差異可以在配置什麼。任何想法都非常受歡迎!