Usecase: panel app and static webpage

Hi,
I have a working panel application using FastListTemplate (127.0.0.1:5016/calc) and a documentation-manual created for it in Sphinx, compiled to HTML (this is an index.html page with a directory structure containing HTML and JS files).
I’d like to create a solution that allows the “panel serve” to up both pages: 127.0.0.15016/calc and 127.0.0.1:5016/wiki i one step.
I’m familiar with the methods described in the Panel documentation (Serve Apps — Panel v1.8.0) and those described by Marc (Further Elaboration on Multi-Page Apps), but I’m having trouble applying them to a multi-file website. I created a simple endpoint plugin (Add custom endpoints to the Panel Server — Panel v1.8.0) based on RequestHandler and StaticFileHandler. After setting the ROUTES, the plugin allows me to correctly display the page with all the elements. Unfortunately, I can’t connect the two elements correctly. If I enable the endpoint via “pn.serve({}, extra_patterns=…)” as a second application, the startup main.py opens a blank page on 127.0.01:5016/main, and “calc” and “wiki” are sent to a different random port. Has anyone tried this solution? Is this the correct approach to this problem?

Best regards,
GB

Hello,
Did you try the --static-dirs when serving your main app Serving static files — Panel v1.8.1.

You will get something like:
panel serve some_script.py --static-dirs wiki=./path_to_your_sphinx_folder

Thanks for the suggestion. Yes, I tried using static_dir, but my “http://localhost:5006/wiki” call returned a “404 Not Found” error. It seems this solution doesn’t support HTTP. I used a endpoint plugin:

ROUTES_STATIC = [
(r"/(.*)", StaticFileHandler, {
"path": "proper_path",
"default_filename": "index.html"
}),]

This solution works, but implementing it as a class in the application requires manually setting the ports for the Calc application and the Wiki. I already have a working prototype, but I’m not sure if it’s a good solution. I’ll post the code in this thread soon and ask for feedback.

You right. When I use http://localhost:5006/wiki or http://localhost:5006/wiki/ I get nothing but if I use http://localhost:5006/wiki/index.html it is working.

By taking a look in the code, it is coming from panel/io/server.py#L905

(rf"{slug}/(.*)", AuthenticatedStaticFileHandler, {"path": path})

Which need to be replaced by

(rf"{slug}/(.*)", StaticFileHandler, {"path": path, "default_filename": "index.html"})

Maybe worth to open an issue on github.