Dokku app.json example for Django

Feb 23, 2018 · Updated: Mar 08, 2018 · by Tim Kamanin

By default, Dokku understands only predeploy and postdeploy directives defined in app.json. To make it a little bit smarter, we need to install the dokku-require plugin:

dokku plugin:install require

The plugin lets us declare plugins and volumes required by a Dokku app.

If declared plugin configuration or volume doesn't exist, dokku-require will create these for us during the deployment phase of the app.

You need to create the app.json file and put it in the root of your app repo:

  "dokku": {
    "plugins": [
      "volumes": [
          "host": "/var/lib/dokku/data/storage/$APP/media",
          "app": "/app/media",
          "phases": "deploy,run"
          "host": "/var/lib/dokku/data/storage/$APP/staticfiles",
          "app": "/app/staticfiles",
          "phases": "deploy,run"
  "scripts": {
    "dokku": {
      "predeploy": "python compress && python migrate --noinput",
      "postdeploy": "curl"

The following app.json example file defines:

  • plugins that describes required dokku services, for example, Postgres and Redis;
  • volumes that maps volumes from the host into a Dokku container, in case of Django, we want staticfiles and media directories to be persistent and available to the host Nginx server, so we map them to the host filesystem.
  • predeploy task that runs collectstatic and compress before the deployment happens;
  • postdeploy task that runs migrations after (and if) successful build has happened.

You can find dokku-require plugin docs here:

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓