Install Pystrano
Pystrano is published on PyPI and currently requires Python 3.12 or newer.
pip install pystrano
Create or inspect a deployment config
By default, Pystrano reads a YAML file from this path:
deploy/<app_name>/<environment_name>/deployment.yml
For an app named api and an environment named production, create:
deploy/api/production/deployment.yml
There is no documented scaffold command in the current implementation, so create the file yourself or adapt the Django example from the package repository.
Configure SSH and server access
The setup command connects as root. The deploy command connects as the configured project_user. Make sure your local SSH keys, remote access, Git host access, and any referenced local files are ready before running live commands.
Preview setup
Use --dry-run first to print commands without executing them.
pystrano setup production api --dry-run
Run setup
Setup creates the deploy user, copies authorized SSH keys, prepares directories, installs packages, creates the virtualenv, updates known hosts, and optionally registers a systemd service and uploads secret files.
pystrano setup production api
Deploy
Preview the deploy first, then run it when the output matches your expectations.
pystrano deploy production api --dry-run
pystrano deploy production api
Roll back
Pystrano does not currently expose a rollback CLI command. Deployments use timestamped release directories and a current symlink, so rollback is a manual server recovery procedure today. See the rollback guide before relying on this in production.
Next steps
Read the VPS guide for a complete Django deployment flow, then review the configuration and secrets pages before using Pystrano with sensitive production systems.