- A
requirements.txt(orPipfile/pyproject.toml). - A
Procfilewith aweb:line that boots your server. - Your server binds to
0.0.0.0on the port you set in the Frame.
Quick start (Flask + Gunicorn)
app.py:
app.py
requirements.txt:
requirements.txt
Procfile:
Procfile
${PORT:-8080} binds PORT if you’ve set it as a Frame variable, otherwise it falls back to 8080. Nubo doesn’t propagate the Frame’s port setting into a PORT env var, so to run on a non-8080 port, add a PORT variable in Frame Settings and set the Frame’s port to match (or just hardcode the port here).
Test locally:
Deploy
Pinning a Python version
Paketo picks a recent Python by default. To pin a version, addproject.toml:
project.toml
Things that trip people up
flask runin your Procfile. That’s the dev server. Use Gunicorn (or Uvicorn for async apps).- Binding to
127.0.0.1. Bind to0.0.0.0so Nubo’s router can reach your app. - Port mismatch. Nubo doesn’t inject the Frame’s port as
PORT. Either hardcode the port your app binds or set aPORTvariable in Frame Settings, and make sure the Frame’s port matches what the app binds. - No
Procfile. Paketo needs aweb:line to know what to launch.
