Skip to content

Deploy Django

Deploy a Django app on Ownkube in minutes. Push your repo and Ownkube builds it and ships it, and you get a live URL with automatic TLS. Managed Postgres, logs, metrics, and one-click rollbacks come built in. No cloud account to start.

  • A Django app in a GitHub or GitLab repository
  • About five minutes
  1. Connect your repo

    Sign in at app.ownkube.io/login, open Settings, and connect the GitHub App (or GitLab) so Ownkube can reach your repository. Already have a prebuilt image in a registry? Point Ownkube at it instead. See Registries.

  2. Create a Web deployment

    From your dashboard, choose Create deployment, pick Web, and select your Django repo. Ownkube builds it and pushes the image to a registry it manages for you.

  3. Set the port

    Django apps commonly serve on port 8000 when run with Gunicorn (gunicorn myproject.wsgi:application --bind 0.0.0.0:8000, replacing myproject with your project’s package name). Set that as the port so traffic routes to your app. You can change it later in Settings. Bind Gunicorn to 0.0.0.0, not 127.0.0.1, or the deployment’s health checks can’t reach your app, and don’t ship manage.py runserver, it isn’t built for production traffic.

  4. Add environment variables

    Set DJANGO_SETTINGS_MODULE, SECRET_KEY, DEBUG=0, and ALLOWED_HOSTS (include the hostname Ownkube generates for your deployment). Mark secrets with the Secret toggle. See Environment variables.

  5. Deploy

    Click Create deployment. The deployment page streams the build, then startup and health checks. When the status goes healthy, open the generated hostname on the Overview tab. Your Django app is live, with TLS included.

Run python manage.py migrate before your app serves traffic. Ownkube’s Jobs resource runs a container to completion, so a migration Job is the right place for migrate rather than running it at request time. Serve static assets by running collectstatic plus a library like WhiteNoise, since there’s no separate static file server in front of your app.

Port 8000

Django apps commonly serve on port 8000 via Gunicorn. Set that as the port so Ownkube routes traffic to your app.

ALLOWED_HOSTS

Django rejects requests whose Host header isn’t in ALLOWED_HOSTS. Add your Ownkube hostname, and any custom domain you attach later.

Migrations as a Job

Run manage.py migrate as a Job before or alongside a deploy, instead of on every container start.

Bring your own Dockerfile

Want full control of the build? Add a Dockerfile to your repo and Ownkube uses it, reading the port from its EXPOSE line.

Need Postgres? Add a Database in one click and Ownkube injects the connection string as DATABASE_URL (plus PGHOST, PGUSER, and friends) into your app. Point Django’s DATABASES setting at it with a helper like dj-database-url. See Databases.

Once you’re running, turn on autoscaling on CPU and memory, watch logs and metrics on every deployment, and roll back a bad deploy in one click.