Deploy Django to Nodion

Deploying a Flask application is straight-forward. We have a native Python environment, you can specify the Python version in the nodion.yml file, as well as some other settings. You can run pip install -r requirements.txt as build_command if you have a requirements.txt file. You can also specify a path to a bash script to keep the build_command clean. Afterwards you can start your Flask app with the start_command.

Example nodion.yml for Django applications

nodion:
  env: python
  build_command: poetry install && python manage.py collectstatic && python manage.py migrate
  start_command: gunicorn app:app
  port: 8000

Example nodion.yml with a Bash script as build_command

nodion:
  env: python
  build_command: ./deploy.sh
  start_command: gunicorn django.wsgi:application

The deploy.sh file could look like this

#!/usr/bin/env bash

poetry install
python manage.py collectstatic
python manage.py migrate