Django

Host a Django app with Postgres

Django and its database deploy together: gunicorn in one container, Postgres in another, each with its own volume, on a private network only your app can see.

Paste this into your coding agent

Run curl -s https://vibecodedhost.com/deploy.md and follow its instructions to deploy this project.

Works in Claude Code, Codex, Cursor and anything else that can run a shell command.

The files

What your agent writes.

You do not have to write any of this. It is here so you can see how little there is, and check your agent's work if a deploy goes wrong.

With this manifest the app would be live at https://my-django-app.vibecodedhost.app. The name is yours to choose, as long as no other app has it.

Every field of vibe.json, explained →

vibe.json
{
  "version": 1,
  "name": "my-django-app",
  "containers": [
    {
      "name": "db",
      "image": "postgres:16-alpine",
      "port": 5432,
      "env": {
        "POSTGRES_USER": "app",
        "POSTGRES_PASSWORD": "app",
        "POSTGRES_DB": "app"
      },
      "volume": "/var/lib/postgresql/data",
      "memoryMb": 384
    },
    {
      "name": "web",
      "build": {
        "context": ".",
        "dockerfile": "Dockerfile"
      },
      "port": 8000,
      "public": true,
      "env": {
        "DATABASE_URL": "postgres://app:app@db:5432/app",
        "ALLOWED_HOSTS": "my-django-app.vibecodedhost.app",
        "CSRF_TRUSTED_ORIGINS": "https://my-django-app.vibecodedhost.app"
      },
      "volume": "/app/media",
      "healthPath": "/"
    }
  ]
}
Dockerfile
FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt gunicorn whitenoise
COPY . .
RUN python manage.py collectstatic --noinput
EXPOSE 8000
CMD ["sh", "-c", "python manage.py migrate --noinput && gunicorn --bind 0.0.0.0:8000 mysite.wsgi"]

Worth knowing

Django on Vibe Hosting

ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS

Django refuses requests for a hostname it was not told about, and refuses form posts from an HTTPS origin it does not trust. Both need the app's public address, which is why they are in the manifest.

Serve static files with WhiteNoise

There is no separate web server in front of your container, so Django serves its own static files. WhiteNoise does that properly with one middleware line.

Migrate on start

Running migrate before gunicorn means every deploy applies its own schema changes. Postgres is listed first, so it is already starting when Django looks for it.

Give Postgres its share of memory

The app's 1 GB is split between containers. Setting memoryMb on the database keeps a busy web process from starving it.

Questions

Before you deploy.

Can I create a superuser?

Yes. Have your agent add a start-up step that creates one from environment variables if none exists, or use Django's createsuperuser --noinput with DJANGO_SUPERUSER_* variables.

Is the database reachable from the internet?

No. Only containers marked public get an address. Postgres is reachable from your app's other containers and from nowhere else.

Built something else? Next.js, Node.js and Express, FastAPI, Flask, React and Vite, Apps with Postgres, Apps with SQLite, Docker Compose projects.

Your app could be online in a few minutes.

Copy the sentence, paste it into your agent, and read the address it gives you back. No account, no card, nothing to pay.

Paste this into your coding agent

Run curl -s https://vibecodedhost.com/deploy.md and follow its instructions to deploy this project.

Works in Claude Code, Codex, Cursor and anything else that can run a shell command.

Would you rather hold the key yourself?

Questions first, or stuck? Contact support and a person replies as soon as possible.