Reputation: 1163
I am posting this question, because all the other posts regarding the issue I am facing are all 11 years old. I am sure quite a bit has changed between now and them, so I do not trust those articles.
I was able to successfully deploy a CherryPy configuration using the cherrypy.quickstart method, and all worked great.
I now have some more capability I am trying to add to the existing Python script, so I need to have additional applications, so I found this in the CherryPy documentation: https://docs.cherrypy.dev/en/latest/basics.html#hosting-one-or-more-applications
Without a ton of information available, I followed those steps, and all the objects exist that the cherrypy.tree.mount is referring to, yet I am getting a "404" path not found.
cherrypy.config.update(
{
"log.screen": True,
"server.socket_host": "scriptbox.its.utexas.edu",
"server.socket_port": 8888,
"server.ssl_module": "builtin",
"server.ssl_certificate": scriptPath()+"/ssl/scriptbox.pem",
"server.ssl_private_key": scriptPath()+"/ssl/scriptbox.key",
"server.ssl_certificate_chain": scriptPath()+"/ssl/server_chain.pem",
"/favicon.ico":
{
'tools.staticfile.on': True,
'tools.staticfile.filename': '/f5tools.ico'
}
})
cherrypy.tree.mount(ServeHelp(), '/')
cherrypy.tree.mount(AS3Tools(), '/as3tohtml')
cherrypy.tree.mount(ServeReport(), '/net_report')
cherrypy.engine.start()
cherrypy.engine.block()
The instance starts successfully. If you go to "/" (root), that works just fine. If I go to either "/as3tohtml" or "/net_report", I get the following error:
404 Not Found
The path '/as3tohtml/' was not found.
Traceback (most recent call last):
File "/opt/miniconda3/envs/p3/lib/python3.8/site-packages/cherrypy/_cprequest.py", line 659, in respond
self._do_respond(path_info)
File "/opt/miniconda3/envs/p3/lib/python3.8/site-packages/cherrypy/_cprequest.py", line 718, in _do_respond
response.body = self.handler()
File "/opt/miniconda3/envs/p3/lib/python3.8/site-packages/cherrypy/lib/encoding.py", line 223, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/opt/miniconda3/envs/p3/lib/python3.8/site-packages/cherrypy/_cperror.py", line 415, in __call__
raise self
cherrypy._cperror.NotFound: (404, "The path '/as3tohtml/' was not found.")
The code around the calls above are:
class AS3Tools:
@cherrypy.expose
def as3tohtml(self, env, as3_file):
as3 = AS3Declaration(env+"/"+as3_file)
if as3.getStatus():
return parse_as3(as3)
and ...
class ServeReport:
@cherrypy.expose
def network_report(self):
net_report = NetworkReport()
if net_report.getStatus():
return generate_report(net_report)
What am I doing wrong? Help?
Upvotes: 0
Views: 18