I have been running panel/bokeh server and having flask display the panel apps on the same machine (vm) for a while. This is my script inside flask per bokeh documentation:
I’m sorry things did not work in the initial attempt.
In my setup, where a Flask app is running as a separate webserver and pulling in the panel/bokeh application, the workaround cited is added to the bokeh server app code whereas you’ve added that to your Flask app if I understand the steps tried.
I will add that the regression I encountered with bokeh 2.2.3 and panel 0.10.2 was resolved with a development branch pointed to by @philippjfr and that was supposedly part of the recent 0.10.3 release that you’re using.
For what it’s worth, my app is using panel 0.10.2 (with the workaround cited) in conjunction with bokeh 2.2.3 and Flask 1.1.2 and deployed on Heroku under the Python 3.8.7 environment.
Really appreciate your continued help.
Finally success!
My bokeh serve command is called from supervisor. Hence my initial attempt to set the BOKEH_RESOURCES variable was in that file. However it didn’t have any effect in the [supervisorctl] block, which I thought was appropriate for the environment variable.
I decided to move it to the [bokehserver] block in conf.d file of supervisor and now it works: the flask is able to embed the panel app.
Here is a sample [bokehserver] block from my conf.d file of supervisor, just in case it helps somebody looking for clarity.
Well, this is quite embarrassing! I swear it was working, and now its not anymore. I can see the panel app in action, but flask cannot seem to display the app using the server-document method. And even more strange, the firebug does not show any error at all.
Its all good and it works. The problem I ran into was due to missing the http:// part of
script = server_document(url=“http://localhost/apps/app1”)