Home Pictures of 3D objects

Running locally

When internet access is missing or poor, you may find it useful to run locally, independent of the internet. At vpython.org, in the section on using VPython without installing software, see the instructions for how to use GlowScript without an internet connection. Before going offline, use the download options at glowscript.org to get local copies of your programs.

Another option is to install Python and the VPython 7 module. At vpython.org see the section on using VPython with installed Python. As long as you don't import Python modules other than vpython, you will also be able to run the program at glowscript.org without having to make changes.

* For developers
If you want to be able to contribute to developing GlowScript, here are the (rather complex) steps required to be able to run locally with changes that you make to the GlowScript code, almost all of which is written in JavaScript (there is also some Python server code and some html code).

* Read an overview of the VPython architecture
See http://vpython.org/contents/VPythonArchitecture.pdf

* Install Python 2.7 (python.org). Google App Engine currently requires Python 2.7

* Install the Google App Engine SDK for Python
At developers.google.com/appengine/downloads, download the package for your platform. Choose Standard environment Python, then scroll down and click "Download and install the original App Engine SDK for Python". If using Linux, unpack to a folder whose name will probably be google_appengine.

* Download the GlowScript source files
At the glowscript repository on GitHub, currently at https://github.com/BruceSherwood/glowscript, clone the repository, or click on "Download ZIP" and unpack the zip file into a new folder named glowscript. On Linux, place this folder parallel to the google_appengine folder.

* On Windows and Mac, the Google App Engine installer includes an app "Google APP Engine Launcher" which simplifies launching GlowScript.

On Windows, there will be a Google App Engine Launcher icon on your desktop, or in your Start menu. Run the app.

On Mac, drag the GoogleAppEngineLauncher out of the installer package (for example, drag it into the Applications folder), then double-click it. When asked, accept the offer to create some symlinks.

In the Launcher, choose File > Add Existing Application and specify the glowscript folder. Make a note of the Port number. Click Add. In ide/api.py and untrusted/run.js, search for "localhost:" and adjust the port number to the number assigned by the launcher.

With the glowscript entry selected in the launcher, click the green Run button. When the Browse button lights up, click it, which will run your standard browser (which should be Chrome for best error reporting).

Click Sign in, then click Login and use the name "test". Write or import a program and check that it runs properly.

* On Ubuntu, in a terminal cd to the google_appengine folder and execute
python dev_appserver.py ../glowscript

Next open a browser, preferably an up-to-date version of Chrome (which gives the best error reporting).

Enter as a URL "localhost:8080"

Click Sign in, then click Login and use the name "test".

* Testing your changes
Suppose the current version of GlowScript is 2.7. Change the version number in a program to 2.8dev; that is, 0.1 greater than the current 2.7, plus dev. When you run the program, it will use your latest JavaScript changes. If you make further changes to the JavaScript code, just reload the program edit page to get the latest changes.

If you want to remake/update the existing version 2.7, or create a new version 2.8, see MakingNewVersion.txt in the docs folder of the GlowScript GitHub repository. Note that use of the build program requires that there be an appropriate version of node in the build-tools folder.

It is very useful to insert console.log(....) at critical points in the JavaScript code, which will generate output to the web page that is viewable if you turn on the browser developer console. On Chrome just press Ctrl-Shift-j.

* Save your test programs
Periodically the Google App Engine launcher will recommend updating the launcher. When you do this, it is often the case that you will lose the VPython programs you used for testing purposes. On Windows these programs are stored in C:\Users\YourName\AppData\Local\Temp\appengine.glowscript. On Mac, look for datastore.db in /private/var/folders/..... It is highly recommended that you keep a copy of the programs folder before updating Google App Engine.

Top of page