
I have a bokeh application with basic authentication and a prefix defined, deployed from embedded bokeh server bootstrap.py file like this:
from bokeh.server.server import Server
from bokeh.server.auth_provider import AuthModule
from bokeh.command.util import build_single_handler_application
# Define Bokeh Prefix Web Context
prefix = "MP"
# Define Bokeh Authentication Module
auth_provider = AuthModule('./auth/auth.py')
# Define Bokeh application
bokeh_app = build_single_handler_application('./main.py')
# Define the server settings, including the cookie_secret
server_settings = {
"cookie_secret": "my super secret",
}
# Embed the Bokeh server in the Tornado application with Authenticacion
bokeh_server = Server(
{'/': bokeh_app},
prefix=prefix,
auth_provider=auth_provider,
**server_settings)
# to resolve some bug in Bokeh Server I must to set the prefix manually
auth_provider._module.login_url = f'/{prefix}/login'
auth_provider._module.logout_url = f'/{prefix}/logout'
# Start Bokeh Server
bokeh_server.start()
bokeh_server.io_loop.start()
I have my project folder structure like this:
poc-bokeh-server |
- auth |
auth.py
login.html
- static |
- images:
image_01.png
image_02.png
- css:
styles.css
bohek_app.py
bootstrap.py
I start the bokeh server from poc-bokeh-server folder like this:
python boostrap.py
The application with prefix and authentication works ok, the login.html is showed but without any style the authentication works ok and redirect to my bokeh app, the logout works ok too.
My problem is the login.html view not load the styles and any images is not loaded too. The error obtain is:
http://localhost:5006/MP/static/css/styles.css 404 not found
NOTE: these resources works ok if not use any prefix using the prefix is impossible access to them using a prefix.
What is the problem?, I must to define these folders statically in tornado when start bokeh server? and how?
For more details the project can be clone and test it from this repo:
https://github.com/masalinas/poc-bokeh-auth

