Host HTML pages

This is a simple example on how to host a HTML page on Domino. There are a number of ways to host web applications of course but this example shows how you can integrate a simple HTTP server using python with Domino. You could also add javascript and other pages to your project. The example in this note just shows how you would start the server to support your pages.

Files

You’ll need to create a file in your project (in addition to your files required for your page such as index.html).

app.py

import http.server
import socketserver
PORT = 8888
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer(("", PORT), Handler)
print ("serving at port", PORT)
httpd.serve_forever()

This script runs a basic HTTP server on port 8888 that serves files from the project directory. Note that port selection is flexible and port 8888 is no longer required.

Step 3: Add a startup script

Tell Domino how to launch your server by creating a simple startup script.

  1. In the project sidebar, go to Code > Add File.

  2. Name the file app.sh.

  3. Add the following line: python app.py

  4. Save the file.

Note that port selection is flexible and port 8888 is no longer required.

Next steps