wwt_data_formats.server Module

A basic HTTP server for local testing of WTML files and other WWT data products.

The key motivation for the existence of this server is that WWT WTML “collection” files must contain absolute URLs. This means that if you’re locally testing a file, you need to include one set of (localhost) URLs, while the production file must be different. Keeping these in sync is tedious and error-prone.

This server is basically a generic local static-file server. But, if specially-marked WTML files are requested, any relative URLs are rewritten on-the-fly to be absolute relative to the server’s address. That way, you can do all of your development with the relative-URL files, and you only need to do one substitution at the very end when the files are ready for upload to the production server. (You can do this with wwtdatatool wtml rewrite-urls.)

This module also contains some helpers for launching web browsers that can interact with this server to display data in the WWT environment.

Functions

launch_app_for_wtml(wtml_url[, image_url, ...])

Launch a WWT data viewer in a new browser window.

preview_wtml(wtml_path[, browser, app_type, ...])

Run a server for a local WTML file and open it in a web browser.

run_server(settings)

Settings are defined in wwt_data_formats.cli.serve_getparser().