awesome-panel / panel-chemistry

🧪📈 🐍. The purpose of the panel-chemistry project is to make it really easy for you to do DATA ANALYSIS and build powerful DATA AND VIZ APPLICATIONS within the domain of Chemistry using using Python and HoloViz Panel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about static-dirs in panel

cschlick opened this issue · comments

Hi, I've been working with the pdbe molstar code and I think it's fantastic. I'm a little confused about how static files would work for panel in a jupyter notebook though. Is there a way to specify an assets directory in a notebook without running panel serve --static-dirs from the command line?

@Jhsmit . Do you know this?

Yes, you can also use Jupyter directly, without the need for panel static dirs

For example like this, when you start jupyter notebook in the panel-chemistry root directory

PDBeMolStar(
    name='Local File',
    sizing_mode='stretch_width',
    height=500,
    custom_data = {
        'url': 'http://localhost:8888/files/examples/assets/1qyn.pdb',
        'format': 'pdb'
    },
)

I've made a PR for add docs but looks like there is a problem with the tests at the moment

How come http://localhost:8888/files/... works @Jhsmit? (I did not know that :-)).

Since you can 'download' all your files and subdirectories from where you run jupyter notebook, I guess some part of jupyter serves all your files on an http server or something like that. Which is of course usually used for downloading your files if you run jupyter remotely, but if you run things locally you can use it to serve your files to PDBeMolStar directly.

It should also be possible to serve local files through something like python's SimpleHTTPServer, but I havent tested this.

Thanks so much guys. I also didn't know about the /files/ aspect to Jupyter, but that works really well for me.