Create the App structure
First, you’ll need to create the app structure. The following is what we end up with, and we discuss each area in turn. Note that/mnt is your Files directory on Domino.
Also, the following names matter: __init__.py, /static, /templates.
Besides those, everything can be customized to your liking in this topic.
Create the folders
In the Files section of Domino make a new folder calledflask_app. This is a Python package that contains 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 are 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__init__.py file in the flask_app folder. This file makes flask_app a Python package. In that file put the following:
run.py.
In run.py add the following:
Domino requires the host configuration for app service to be
0.0.0.0. However, port selection is flexible and port 8888 is no longer required. If your hosting network uses a different default, you can specify that default in your app file or some alternate configuration.Customization
Now we’re going to add aviews.py file. This file is where you place all your app logic and should be created in the flask_app directory.
We’ll make a simple app that just returns “Hello World!”
Add the following to views.py:
Publish the App
- Click Deployments > App from the project sidebar.
- Give your app an informative title and description, and set permissions to Anyone can access. This allows anyone with a network connection to your Domino deployment to access the app if they have the URL.
- Select your app file.
- Click Publish Domino App.
- After the App status says “Running”, click View App to load your app.