Django-first deployment automation

Capistrano-style deployments for Django apps

Define repeatable SSH-based Django deployment workflows with simple YAML playbooks.

FastAPI support is planned next.

  • YAML configs live with your deployment files
  • Setup and deploy over SSH
  • Release directories keep recovery options visible
pystrano deploy production api
$ pystrano deploy production api
✓ Connecting to production api (app1.example.com)
✓ Prepared release directory
✓ Pulled branch main
✓ Synced shared assets and env file
✓ Installed Python dependencies
✓ Applied migrations and refreshed static assets
✓ Promoted release to current
✓ Restarted gunicorn.service
✅ Deployment completed in 42s
Pystrano is currently tested and documented for Django deployment workflows. FastAPI support should be treated as planned until its workflow is implemented, tested, and documented.
Why Pystrano?

A small tool for repeatable Django deploys.

Pystrano automates the SSH deployment steps you would otherwise keep in shell notes: prepare a server, create timestamped releases, install dependencies, run Django management commands, update the active release, and restart the app service.

YAML configuration

Keep common defaults and server overrides in deploy/<app>/<environment>/deployment.yml.

Django deployment steps

Run setup once, then deploy releases that can install requirements.txt, run migrations, collect static files, and restart systemd.

Rollback-aware structure

Deploys create timestamped release directories and promote the active release with a current symlink. A rollback CLI command is not exposed yet.

Workflow

Configure, preview, deploy.

Pystrano assumes you already have SSH access to a VPS-style server and know where your Django app should live.

1
Create deployment config

Define repository, deploy user, virtualenv path, service file, environment file, and per-server Django options.

2
Run setup

Use pystrano setup production api to create the deploy user, directories, packages, virtualenv, known hosts, and optional service files.

3
Deploy releases

Use pystrano deploy production api to clone code, install dependencies, run Django tasks, promote the release, and prune old releases.

Documentation

Start with the Django path.

The docs focus on the supported workflow today: deploying Django apps over SSH with Gunicorn and systemd on VPS-style servers.

Configuration sample
common:
  source_code_url: "git@github.com:example/example-django-app.git"
  project_root: "apps/example-django-app"
  project_user: "deploy"
  venv_dir: ".venv"
  keep_releases: 5
  system_packages: |
    libpq-dev
    python3-dev
    build-essential
  env_file: "./deploy/api/production/.env"
  ssh_known_hosts: "github.com"
  service_file: "./deploy/api/production/gunicorn.service"
  branch: "main"
  clone_depth: 1

servers:
  - host: "app1.example.com"
    port: 22
    run_migrations: true
    collect_static_files: true
pystrano setup production api --dry-run
pystrano deploy production api --dry-run

Build a repeatable Django deploy.

Install Pystrano, create a deployment config, preview the remote commands, then run setup and deploy when your server is ready.