Migrations Migrating from Heroku, Render, Hatchbox or Cloud 66? We move your production app within 48 hours →
Django

Django

Deploy Django with Postgres, Celery or RQ workers, collectstatic and migrations.

  • Detected from requirements.txt, pyproject.toml or a manage.py that imports Django.
  • Release: python manage.py migrate --no-input.
  • Web: gunicorn on $PORT — set your WSGI module in the start command if it isn’t wsgi:application.
  • Workers: Celery (celery -A <project> worker, project read from DJANGO_SETTINGS_MODULE), Celery Beat, RQ, Huey, Dramatiq and Django-Q are offered when they’re dependencies.
  • Database: psycopg → Postgres, with DATABASE_URL injected.

Processes: one codebase, several roles

web, worker and a scheduled beat process are the same image started with a different command — 12-factor’s process model, not separate apps to keep in sync with each other. Declare them yourself in a Procfile:

web: gunicorn myproject.wsgi:application --bind 0.0.0.0:$PORT
worker: celery -A myproject worker --loglevel=info
beat: celery -A myproject beat --loglevel=info

or skip the Procfile and let detection offer the worker for you from whichever job library is in your dependencies. Add more from the app’s Workers tab, or scale what’s there from the CLI:

railyard scale my-app worker=2

See Workers and scheduled jobs for cron.

Static files

python manage.py collectstatic --noinput runs automatically during the build — the same convention Heroku uses for Django apps — so WhiteNoise or any STATIC_ROOT setup just works with no Dockerfile step or pre-deploy hook to write. An app that doesn’t use django.contrib.staticfiles is unaffected, and a failure here doesn’t block the rest of the build. Set DISABLE_COLLECTSTATIC=1 to opt out.

Config and secrets

DATABASE_URL is injected automatically from your Postgres addon; REDIS_URL is too, once your dependencies pin a Redis client (redis, django-redis, rq) — point Celery’s broker and result backend at it yourself. Everything else — DJANGO_SETTINGS_MODULE, SECRET_KEY, feature flags — is a plain env var under Variables, or railyard env:set my-app KEY=VALUE from the CLI, so the same image runs unchanged from staging through production: dev/prod parity, not a build-time branch. Point at a database or Redis running as its own service on the canvas with ${{redis.RAILYARD_PRIVATE_URL}} — resolved per environment. See Variables and secrets.

Deploy it

  • From a repo: paste the Git URL, or pick it from the picker once GitHub is connected — Railyard reads requirements.txt/pyproject.toml, fills in gunicorn, the migrate release command and DATABASE_URL, and deploys on every push.
  • From the CLI: railyard create my-app https://github.com/me/my-app --addons postgres,redis, or railyard git:remote && git push railyard main from inside the repo.
  • One click: add the deploy button to your README, or publish to the template catalog so anyone can launch it with its addons and variables already filled in.
Found an issue or have a question?
Theme
Colors