Web apps

    Deploy Django on Oracle Cloud's free tier

    Gunicorn, static files and migrations on an Always Free ARM VM — with a real filesystem and no cold starts.

    At a glance

    Base imagepython:3.12-slim
    Port8000
    Build commandpip install -r requirements.txt && python manage.py collectstatic --noinput
    Start commandgunicorn config.wsgi:application --bind 0.0.0.0:8000
    Infrastructure cost$0 on Oracle Always Free (platform fee for managed DevOps)

    Running Django on Ampere ARM

    Every wheel Django needs (psycopg, Pillow, cryptography) ships an aarch64 build, so installs are fast. Size workers as (2 x OCPU) + 1 — three workers on a 1 OCPU instance is a sensible default.

    Steps

    1. Pin your dependencies. Freeze requirements.txt so the image build is reproducible across rebuilds.
    2. Set ALLOWED_HOSTS and CSRF origins. Django rejects requests from an unknown host with a 400 before your view ever runs.
      ALLOWED_HOSTS = [".yourdomain.com"]
      CSRF_TRUSTED_ORIGINS = ["https://yourdomain.com"]
    3. Run migrations on release. Add `python manage.py migrate --noinput` as a release command so schema changes apply before traffic shifts.
    4. Deploy. Cheaploy builds, health-checks /healthz and rolls back automatically if the new container fails to answer.

    Dockerfile for Django on ARM64

    FROM python:3.12-slim
    WORKDIR /app
    ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
    RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev \
     && rm -rf /var/lib/apt/lists/*
    COPY requirements.txt .
    RUN pip install --no-cache-dir -r requirements.txt gunicorn
    COPY . .
    RUN python manage.py collectstatic --noinput
    EXPOSE 8000
    CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3"]

    Need one tailored to your repository? The free Dockerfile generator writes an ARM-ready multi-stage build for you.

    Common mistakes

    • DEBUG left on: A leaked settings module with DEBUG=True exposes your environment on any error page. Drive it from an env var.
    • SQLite on a container filesystem: Mount a Docker volume, or the database disappears on every redeploy. Use Postgres for anything with real users.
    • Static files 404: collectstatic must run inside the image, and WhiteNoise (or Nginx) must serve STATIC_ROOT.

    Related reading

    Get the Oracle Always Free deploy checklist

    One email with the exact steps, capacity workarounds and tools we use to ship apps for $0 of cloud spend.

    One email, no spam. Unsubscribe anytime.

    Frequently asked

    Can I run Celery too?+

    Yes — run a second container with the same image and a `celery -A config worker` command, plus a Redis container on the same VM.

    How many requests can one Always Free instance handle?+

    A 1 OCPU Ampere instance with three Gunicorn workers comfortably serves a few hundred thousand requests a day for a typical CRUD app.

    Where does Postgres run?+

    Either as a container on the same VM, or on the Always Free Autonomous Database. Both cost $0.

    Deploy your project for $0

    No credit card. No Oracle sales call. Ship to your own cloud in under 10 minutes.

    Start free