Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serving Static Files in IJulia #339

Closed
rohitvarkey opened this issue Aug 16, 2015 · 6 comments
Closed

Serving Static Files in IJulia #339

rohitvarkey opened this issue Aug 16, 2015 · 6 comments

Comments

@rohitvarkey
Copy link

Hi,

I've been working on Compose3D and I've kind of run into a roadblock that I'd like your advice on.

The ThreeJS-WebGL backend that I'm using for Compose3D emits custom web component tags that are then use to draw the 3D images. For this to work, I need to do a HTML import and as a result I need to be serving the static files somewhere.

I wrote a build script that would just copy the files to profile_julia/static/components/compose3d/ and this works pretty okay when the user was doing ipython notebook --profile=julia.

But now that just ipython notebook works, should I copy the files to the default profile? This doesn't work on places like JuliaBox, where a different profile is used by default. Should I have to copy the files to every profile or is there a better way of handling this?

Thanks,
Rohit.

@stevengj
Copy link
Member

Why can't you just emit the HTML directly into the notebook, e.g. with display("text/html", ".....")?

@shashi
Copy link
Contributor

shashi commented Aug 19, 2015

@stevengj the problem is importing the same web component declaration twice is a fatal error. So if you restart the kernel and run using Compose3D again (which loads the dependency through display(...)), your notebook won't work.

This is also one of the reasons stopping Escher from being used inside IJulia.

@stevengj
Copy link
Member

@shashi, maybe IJulia should export a display_once function or similar to import web components? Oh, no, that won't work if you restart the kernel.

It seems like this is something that you should report upstream to Jupyter.

@shashi
Copy link
Contributor

shashi commented Aug 20, 2015

Opened an issue on the jupyter notebook repo jupyter/notebook#319

@shashi
Copy link
Contributor

shashi commented Aug 20, 2015

Oh, also, there is another problem I forgot about which Rohit mentions above:

If you are using HTML imports, a file x.html can import y.html so reading in x.html using display will not be sufficient (it will lead to a 404 when it tries to load y.html). One could use a tool to concatenate all of them together though but that is not so ideal when you want to import things as you need them interactively. It would be nice to have them served from disk and loaded as and when required by displaying some Javascript for it.

I think a proper solution to this would involve some way for notebook code to register a directory to be served in a static URL location - again this seems like a feature that Jupyter will need to make possible.

@stevengj
Copy link
Member

Closing as a Jupyter/notebook issue, not IJulia.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants