Host HTML pages

You can use Domino to host simple static web pages, such as HTML documents with optional JavaScript and CSS. This guide shows how to set up a lightweight Python server to serve your pages.

What you’ll do

By following this guide, you will:

  • Create a project that contains your HTML files.

  • Add a small Python script (app.py) to serve those files over HTTP.

  • Publish the project as a Domino App.

Prerequisites

  • Access to Domino with permissions to create projects.

  • A basic HTML page (for example, index.html).

  • Optional: supporting files such as CSS or JavaScript.

Step 1: Create a Project

Start by creating a Domino project to hold your HTML files and related assets.

  1. In Domino, go to Develop > Projects > Create Project.

  2. Name your project and click Create.

  3. Add your HTML file(s) (for example, index.html) to the project.

Step 2: Add a Python server script

Next, add a lightweight Python server that can serve your HTML files when the App runs.

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

  2. Name the file app.py.

  3. Paste in the following code and save the file:

    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.

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.

This tells Domino how to start the server when the App runs.

Step 4: Publish the App

Now publish the project as a Domino App so your HTML page can be accessed through a browser.

  1. In the project sidebar, go to Deployments > Apps.

  2. Add a title and description for your App.

  3. Set permissions.

  4. (Optional) Define a custom URL path, such as /apps/html-demo.

  5. Select app.py as the launch file.

  6. Click Publish.

Domino provisions the container, runs app.py, and makes your HTML page accessible at the App’s URL.

Step 5: Share the App

Finally, share your hosted page with collaborators or test it yourself.

  1. In the project sidebar, go to Deployments > Apps.

  2. Click Copy App Link.

  3. Share the URL with collaborators or open it in a browser to view your hosted HTML page.

Next steps