Local image file rendering with login template

I am trying to customize the default login template file for basic authentication. I have a local logo file, but specifying its file URL as shown below in the src attribute doesn’t work (image is not rendered)

<img id="logo" src="file:///somepath/logo.png" width="300" height="200">

I have also tried specifying relative and absolute OS file paths, but that does not work either.

As described in this bokeh topic, one way to make this work is to:

  • Have a directory with the app in ‘main.py’ and a sub-directory called ‘static’ with the image file
  • Run the app one level above the directory with panel serve ... <directory name>

This does work, but is there a simpler way to do this? It seems a bit convoluted just to get the logo to render.

Thanks for your help.