These docs are a work-in-progress and are currently undergoing a major rewrite!


Use Postgres for local Django development via Docker.


Django + Forge Quickstart

If you use the Forge Quickstart, everything you need will be ready and available as forge db.

Install for existing Django projects

First, install forge-db from PyPI:

pip install forge-db

Then add it to your INSTALLED_APPS in


Now you will have access to the db command:

python db

You will need to have a DATABASE_URL environment variable, which is where the database name, username, password, and port are parsed from:

# .env

You can use a POSTGRES_VERSION environment variable to override the default Postgres version (13):

# .env

In most cases you will want to use dj_database_url in your to easily set the same settings (works in most deployment environments too):

import dj_databse_url

    "default": dj_database_url.parse(
        environ["DATABASE_URL"], conn_max_age=environ.get("DATABASE_CONN_MAX_AGE", 600)

You will also notice a new .forge directory in your project root. This contains your local database files and should be added to .gitignore.


If you use forge-work, then most of the time you won't need to interact with forge-db directly. But it has a few commands that come in handy.

  • forge db start - starts a new database container and runs it in the background (use --logs to foreground it or connect to the logs)
  • forge db stop - stop the database container
  • forge db reset - drops and creates a new database
  • forge db pull - pulls the latest database backup from Heroku and imports it into the local database

In the end, the database container is like any other Docker container. You can use the standard Docker commands and tools to interact with it when needed.