Creating a Flask web app in Domino

The following guide will set up your Domino project more as a proper web site powered by Flask. This isn’t difficult; you just need to make sure all the folders and files are in place to ensure the app runs correctly.

(Note: This article will create an app using the MVC method.)

Creating the App Structure

First, you’ll need to create the app structure. The following is what we’ll end up with and will discuss each area in turn.

Note: /mnt is your Files directory on Domino. Also, the following names matter:,, /static, /templates. Besides those, everything can be customized to your liking in this article.

|-- ...
|-- /flask_app
    |-- /static
    |-- /templates

Create the folders

In the Files section of Domino make a new folder called flask_app. This will be a Python package that will contain the web app.

In the flask_app folder put two other folders, one called “static” the other “templates”. In the “static” folder you put your static files and in the “templates” folder you put your template files. The static and templates folders will be recognized by Flask to know from where to fetch the appropriate files. It’s possible to change which folder is noticed as the “static” folder, but common practice is to just leave it as static.

Create the files

Create an file in the flask_app folder. This file will make flask_app a Python package. In that file put the following:

from flask import Flask

class ReverseProxied(object):
  def __init__(self, app): = app
  def __call__(self, environ, start_response):
      script_name = environ.get('HTTP_X_SCRIPT_NAME', '')
      if script_name:
          environ['SCRIPT_NAME'] = script_name
          path_info = environ['PATH_INFO']
          if path_info.startswith(script_name):
              environ['PATH_INFO'] = path_info[len(script_name):]
      return, start_response)

app = Flask(__name__)
app.wsgi_app = ReverseProxied(app.wsgi_app)

Back in your Files section of Domino create a new file called

In add the following:

from flask_app import app
from flask_app import views

if __name__ == '__main__':

Change your file in the Files section of Domino to:

!/usr/bin/env bash
export FLASK_DEBUG=1
python -m flask run --host= --port=8888


Now we’re going to add a file. This file is where you place all your app logic.

We’ll make a very simple app that just returns “Hello World!”

Add the following to

from flask_app import app

def index():
    return "Hello World!"

If you have a template in the templates folder, you would add:

from flask import render_template
from flask_app import app

def index():
    return render_template('hello.html')


Now once you publish the app, when you go to your app url, you should see “Hello World!”

To see an example with a larger template file utilizing flask_bootstrap, you can fork this project.

Was this article helpful?
0 out of 0 found this helpful