Python Flask Quickstart

This is a Python Flask Quickstart for Nullstone. This is based on the Flask official quickstart guide.

This uses the Nullstone official nullstone/flask image.

How to launch via Nullstone

  1. Create a public web app. (Remember app-name for later)
  2. Add the SECRET_KEY for Flask Cookies capability to the app.
  3. Provision
nullstone up --wait --block=<app-name> --env=<env-name>
  1. Build, push, and deploy
docker build -t flask-app .
nullstone launch --source=flask-app --app=<app-name> --env=<env-name>

How to run locally

You can run this project locally inside Docker or using elixir alone. To use docker, this project contains docker-compose.yml that runs with MIX_ENV=dev. This setup ensures that using Docker doesn't inhibit typical development workflows:

  • Hot reload is configured so that changes to the app doesn't require a reboot
  • Dependencies are installed on boot of docker container
  • FLASK_DEBUG is set to enable the debugger.
docker compose up

Visit http://localhost:9000.

Hot reload

The app in docker-compose.yml is configured to run flask in debug mode. You do not need to rebuild/restart the flask app when making changes to code.

Update dependencies

Any time you change requirements.txt, you need to update your dependencies. The dependencies will be installed on boot of the docker container; restart the container to update.

docker compose restart app