Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > DSS Supplement > Publishing a model to the internet.

4. Create files for hosting on a server

Scroll Prev Top Next More

When you have your model view ready (which hopefully includes graphs and sliders that work well in SyntheSim mode), click File->Publish Web Files.

 

You will see a window appear which converts the model into C code which is then compiled by Emscripten.

 

Once the compilation is complete, Vensim will inform you if the compilation has been successful. If it has been successful, find the folder where your model is stored on your computer, in here you will find a sub-folder titled "web". The following files should be located in this folder.

 

 -        index.html

 -        d3.min.js

 -        mdl.js

 -        mdl.wasm

 -        sketch.png

 -        vensim_wasm.js

 -        wasm-arrays.min.js

 

You now need to copy all of these to a web server. There is plenty of information on the internet on how to do this,

https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Upload_files_to_a_web_server

 

If you do not have access to a web-server, you can search the internet for free web hosting.

 

For testing, the programming language Python has a built in web-server. Save the following script to a file titled webserver.py and run it from Python.

 

 

import http.server

from http.server import HTTPServer, BaseHTTPRequestHandler

import socketserver

 

PORT = 8080

 

Handler = http.server.SimpleHTTPRequestHandler

 

Handler.extensions_map={

   '.manifest': 'text/cache-manifest',

 '.html': 'text/html',

   '.png': 'image/png',

 '.jpg': 'image/jpg',

 '.svg':        'image/svg+xml',

 '.css':        'text/css',

 '.js':        'application/x-javascript',

 '.wasm': 'application/wasm',

 '.json': 'application/json',

 '.xml': 'application/xml',

 '': 'application/octet-stream', # Default

   }

 

httpd = socketserver.TCPServer(("", PORT), Handler)

 

print("serving at port", PORT)

httpd.serve_forever()