Call the main.py directly panel serve myapp\main.py (this shouldn’t be the way…)
Call pn.serve(mypanel) from the python code and run the python script
Try all the above with and withouth including myapp in the path (‘myapp\static\jquery-1.11.1.min.js’)
Nothing works. My question is: in what path is the server expecting the .js files?
Fun fact, I can include local .css files with pn.extension(css_files=['static\style.css'])
I never really figured out what the problem was, but it works now. For anyone with similar issues:
I rebuilt my conda environment and I have the following versions installed:
panel=0.9.5
bokeh=2.0.1
The js files are included using js_files = {'jquery': 'app\\static\\jquery-1.11.1.min.js', 'goldenlayout': ''app\\static\\goldenlayout.min.js'} pn.extension(js_files=js_files)
I simply call panel serve app
from te folder containing app and it works fine.
I restyled the golden-layout a bit. I also made a (somewhat dodgy) python module that generates javascript code for the golden-layout based on relatively few lines of python code. The python code for the example in the video is:
Furthermore I made a KPI widget (inherited from pn.pane.HTML) that autoupdates using a periodic callback and restyled the plotting layout to my liking (holoviews with bokeh backend).
It is all still a bit experimental. I was considering making it a more mature package to enable a high level interface for the combination of panel and golden-layout + some default layout tweaks. However, I am really struggling with the way the panel server (i.e. bokeh) operates. Because I have a directory style I need to call panel serve myapp. This prevents me from using pycharm debugging mode, and I can’t wrap my directory style app in a package (the static files need to be in myapp). This would all be solved if it would just be possible to launch a directory style app from python (pn.serve(mypanel). But apparantly that is not possible. Any advice would be appreciated.
I think that not a lot of people in Python knows how powerful Panel is.
It would really help them and Panel if you did a short tweet with the video. gif and provided a link to the tweet below. I can also do it if that is better for you.
Also I would like to add a simple example to the gallery at awesome-panel.org if that would be ok with you?
I am happy to share this if it contributes to showing the possibilities of panel. I am a bit social media shy so I do not intend to tweet or blog about it. However, I have no problems with you using it on your website or any other channel. Nice website by the way (awesome-panel.org)!
Let me first fix a few loose ends in the code and refactor to make it all somewhat comprehensible for others. Then I will put it on github and share the link here.
And the .show() really solved my debugging issues! I wasn’t aware of the .show() option actually. Thnx for the advice @Marc.
I have finally found some time to put my work on combining panel with the golden-layout on github: here is the link. Note that currently it is a stub, and I am an inexperienced (open source) package developer, but let’s where it goes. I am definetly open to suggestions or advice.
I have been working in the golden layout a time ago and it is really difficult to do it work in the right way. I have a small question about the resizing of the plots. I would like that the bokeh plots adjust their size to the size of the GL container when the container is re-sized in the ‘stretch-both mode’ of the plots but I dont know how to do it.
I found something about dispatch resize event in javascript ( window.dispatchEvent(new Event('resize'));) but after 3 weeks trying to learn a little of js the solution keeps hiding for me.
regarding the global message service I use something similar (I believe) for progress reporting and have a plan for a general message service for awesome-panel.org too.
I did not try to adapt the .js code; too many curly braces for my taste. What I did is set the Bokeh option “responsive” to True. In my case in the custom Bokeh theme, but it should also work as a kwarg. In principle that should do it. I did have to explicitly set the golden-layout frames to non-scrollable to prevent scrollbars.
Hi @Leonidas, thanks for providing this amazing golden template. This will for sure be very helpful for me.
I’m getting some 404 errors:
2020-05-27 15:11:00,633 404 GET /assets/panel-customizations.css (::1) 0.97ms
2020-05-27 15:11:00,789 404 GET /assets/js/jquery-1.11.1.min.js (::1) 1.00ms
2020-05-27 15:11:00,789 404 GET /assets/js/goldenlayout.min.js (::1) 1.00ms
2020-05-27 15:11:00,860 404 GET /assets/js/jquery-1.11.1.min.js (::1) 1.00ms
2020-05-27 15:11:00,863 404 GET /assets/js/goldenlayout.min.js (::1) 0.00ms
Is this the same as your original issue? The panel-customization.css seem to be missing from the repository, I can only find the -dark and -light versions.
EDIT: I found the static_dirs kwarg but I dont have the development version of panel installed so I replaced the static paths with absolute directory paths. This fixed the 404 erros but i cant load the scripts:
Loading failed for the <script> with source “c:\Users\jhsmi\pp\elvis\assets\js\jquery-1.11.1.min.js”.
You are right about the missing .css file, this is fixed now.
Serving from the command line requires the inclusion of “elvis” in the paths to the assets, I forgot that. I have refactored a bit a included a .servable method now, which should make it easier to serve from the command line (without the need to work on the dev install of panel). So no need any more to manually adapt paths.
Now the problem with the .js files not being found is something I get too! That is what started this thread initially. At some point I ‘solved’ it, but I never understood how. I only played around with my conda environments, but now I have the exact same versions of bokeh and panel as I had when it worked! So this is still a mystery to me.