Vpython on a remote http server

83 views
Skip to first unread message

Lucas

unread,
Jul 2, 2017, 10:46:01 PM7/2/17
to VPython-users
I am studying Vpython to see if it can be used to display different 3D images for different remote users.
Now I am running standard Vpython 7.0 which can automatically start a web server and display 3D images on web page.
My question is how can I integrate this output to my other web pages? For example, after a user login, it will display the 3D images belongs to this user only.
Thanks,
Lucas
 

Bruce Sherwood

unread,
Jul 3, 2017, 12:34:12 AM7/3/17
to VPython-users
Three answers:

1) If it is not essential to use other Python modules, the easy scheme is to use GlowScript VPython. Create the program in a private folder. On the edit page, click "Share or export this program". Copy the compiled code into your web page.

2) If  you are able to run your own server, you could in principle modify the web machinery of VPython 7 web communications to do what you want. There doesn't exist at this time an easy way to do this, but Aaron Titus has been experimenting with something that might lead to such a capability being built into VPython 7.

3) Probably even more challenging, but it is possible to run your own Jupyter notebook server.

ZYuan X

unread,
Dec 20, 2017, 12:38:24 AM12/20/17
to VPython-users
I have encountered the same question. 

1). Is there a good solution to run a vpython application using browser with a remote http server right now?

2). Can I set a fixed port number when I run my vpython program (i.e., a hello.py file). Which means that the location in browser is http://localhost:8000/, as an example, the 8000 is a fixed port.

3). If 2) is possible, I doubt whether it is possible to use nginx and uwsgi  to distribute my vpython program.

Steve Spicklemire

unread,
Dec 20, 2017, 7:34:33 AM12/20/17
to vpytho...@googlegroups.com, Steve Spicklemire
You might consider jupyterhub: <https://jupyterhub.readthedocs.io/en/latest/>. We’re running one of these on our campus (behind a firewall) with nginx (now uwsgi).

Depending on what you’re trying to do exactly, you might also be able to use:

https://github.com/oschuett/appmode

or

https://mybinder.org

or some combination of the above to put your vpython program online. Note that all of these options produce a fully interactive jupyter notebook that users can *edit* and run.

As Bruce says below, if you just want to show the WebGL window you might be able to adjust the VPython 7 startup code to enable that.

-steve
> --
> You received this message because you are subscribed to the Google Groups "VPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Aaron Titus

unread,
Dec 20, 2017, 11:02:40 AM12/20/17
to vpytho...@googlegroups.com
We have successfully run VPython in a Jupyter Notebook that was running on a server. I’ve done this in two different situations:

1. We ran Jupyter Notebook on a Raspberry Pi and accessed the notebook with a browser running on a different computer. We set it up using the instructions at:


2. I ran Jupyter notebook on a AWS server and accessed it from a remote browser.

On the server, I ran: 

 jupyter notebook --no-browser --ip=theIpAddress

Then in the browser on a client computer, I went to the address of the server with port 8888.

In summary, using the Jupyter notebook, I think it’s fairly easy to run VPython remotely.

I did look into the “guts” of vpython to see if it could be configured to use an IP address other than localhost. However, it required more detailed knowledge and more time than I could give to the project. So, I used Jupyter notebook instead. 

It seems like one could configure VPython to do what you want.

Aaron


On Dec 20, 2017, at 12:38 AM, ZYuan X <ziyua...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages