How to access file from a Bokeh server which started from within the script itself (standalone/embedded server)

(Posted before to Stack Overflow without results)

I am currently developing a Bokeh dashboard to display pdfs. When starting the bokeh server from within the script itself, I have trouble accessing local files.

My directory structure looks as follows:

├── static
│   └── test.pdf

Here, I would like to start the server from within (i.e. not via bokeh serve app).

Minimum example of what I have tried so far:

import os
import argparse

import bokeh.models
import bokeh.server.server

def app(doc):
    text = '<embed src=\"static/test.pdf#page=6\"></embed>'

    div = bokeh.models.Div(text=text)

if __name__ == '__main__':
    port    = xxxx
    host_ip =
    origin  = f'{host_ip}:{port}'
    server = bokeh.server.server.Server(
        {'/': app},

I develop on a remote server to which I connect via ssh, hence the server settings.
However, when I run python from within the directory app, I get the error message 404 GET /static/test.pdf .
What is the path by which I can access the PDF? Is this even the correct approach?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.