Для трех простых приложений: давайте использовать порт, отличный от 8080:
cherrypy.config.update({'server.socket_host': '127.0.0.1',
'server.socket_port': 28130
})
Давайте настроим три приложения:
fusionConf = {'/ fusion': {}} mobileConf = {r "/ mobile_to_fusion": {}} adminConf = {'/ admin': {}}
cherrypy.tree.mount (fusionListener, r "/ fusion", fusionConf) cherrypy.tree.mount (mobileListener, r "/ mobile_to_fusion", mobileConf) cherrypy.tree.mount (adminListener, r "/ admin", adminConf) #
cherrypy.engine.start () cherrypy.engine.block ()
Мы видим, что он работает на правильном порту:
$netstat -an | grep 28130
tcp4 0 0 127.0.0.1.28130 *.* LISTEN
Журнал приложения соглашается:
CherryPy Checker:
The application mounted at '/fusion' has config entries that start with its script name: '/fusion'
CherryPy Checker:
The application mounted at '/mobile_to_fusion' has config entries that start with its script name: '/mobile_to_fusion'
CherryPy Checker:
The application mounted at '/admin' has config entries that start with its script name: '/admin'
Но при доступе к URL: http://localhost: 28130 / admin - Не найдено?
404 Not Found
The path '/admin' was not found.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/cherrypy/_cprequest.py", line 638, in respond
self._do_respond(path_info)
File "/usr/local/lib/python3.8/site-packages/cherrypy/_cprequest.py", line 697, in _do_respond
response.body = self.handler()
File "/usr/local/lib/python3.8/site-packages/cherrypy/lib/encoding.py", line 219, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/cherrypy/_cperror.py", line 416, in __call__
raise self
cherrypy._cperror.NotFound: (404, "The path '/admin' was not found.")
Powered by CherryPy 18.5.0
Почему Cherrypy
не находит пути?