xudbinSERVER PANEL

← All guides

Deploying a Django app on your own server

Deploy a Django project from GitHub with Xudbin, connect a database and fix deploy errors with Deploy Doctor. No Dockerfile needed.

2 min read

Before you start

  • A server with Xudbin installed (see the installation guide)
  • A Django project on GitHub with requirements.txt in the repo

1. Create a project

Press Projects > Create project and give it a name. Each project has its own Docker network; an app in one project can't reach another project's database.

2. Add a database

Create a PostgreSQL database inside the project. You'll add its connection details to the app's environment variables.

3. Add the app

  1. Choose Add app > Git repository and enter the repo URL. For a private repo, enter an access token, or use Pick from GitHub if the GitHub App is connected.
  2. Press Inspect repo. Xudbin scans it and suggests Django. If the repo has no Dockerfile, Xudbin generates one and shows it in the deploy log.
  3. Leave Run migrate on every deploy enabled on the Django card.

4. Environment variables

In the Settings step press Add all required; values like the secret key are generated for you. Instead of typing domains by hand, use these placeholders:

DJANGO_ALLOWED_HOSTS={{XUDBIN_DOMAINS}}
CSRF_TRUSTED_ORIGINS={{XUDBIN_ORIGINS}}

They're filled with the app's current domains at deploy time, so adding a domain later needs no config change. Values are stored encrypted.

Make sure settings.py reads them:

ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", "").split(",")
CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS", "").split(",")

5. Deploy

Press Create and deploy. The live log streams in the Deployments tab. The new version takes over traffic only after it answers the real domain with a healthy response; if it returns 400 or 5xx, the old version stays live.

Once live, the General tab shows its automatic address, like app-x7k2.1-2-3-4.sslip.io.

If the deploy fails

Press Deploy Doctor > Diagnose in the General tab. Common Django problems are recognized and explained: ALLOWED_HOSTS, CSRF, a missing secret key, database connection, migrations, a missing package or running out of memory. Fixable ones are fixed in one click and redeployed.

To search older logs, look for Traceback or 500 in the Logs tab.

Automatic deploys

With the GitHub App connected you can deploy on every push and get a separate preview address for each pull request.