NewOut Plane raises funding, backed by Maza VenturesRead the announcement
Back to Blog
Comparison

Django Hosting in 2026: Deploy Without Managing Servers

Recep Erdoğan••14 min read
Django Hosting in 2026: Deploy Without Managing Servers

Django is one of the most productive ways to build a web application, and one of the most fiddly to put into production. The framework itself is well documented and predictable. The gap is everything around it: a WSGI or ASGI server to run the app, a reverse proxy for TLS, a real database instead of SQLite, a place to serve static files, and a plan for running migrations on every deploy. None of that is Django's job, and all of it lands on you the first time you type git push and expect a live URL.

There are two honest ways to close that gap in 2026. You can rent a plain virtual server and assemble the stack yourself, or you can use a platform that treats a Django repository as something it already understands. This comparison walks through both, shows the exact production settings Django needs, and gives you copy-paste configuration for gunicorn, ASGI, static files, migrations, and a managed Postgres database.

The short answer: Django hosting in 2026 splits into self-managed servers and managed platforms. A VPS gives full control at the cost of running gunicorn, TLS, backups, and patches yourself. A platform like Out Plane builds your repo, runs gunicorn or an ASGI worker on the port you expose, provisions managed PostgreSQL, and gives you HTTPS and a domain. Starter and Pro both open with a 14 day free trial, and no plan has cold starts.

What "Django Hosting" Actually Involves

Django hosting means running the Python process that serves your application, plus the supporting pieces the framework expects in production. It is not one thing, it is a short list that has to all be true at once:

  • An application server. Django's built-in runserver is for development only. Production needs a WSGI server such as gunicorn, or an ASGI server such as uvicorn if you use async views, Channels, or websockets.
  • A bound network address. The server has to listen on 0.0.0.0 and the port the platform routes traffic to, not 127.0.0.1:8000.
  • ALLOWED_HOSTS set correctly. Django refuses requests whose Host header is not in this list, so it must include your production domain.
  • Static files collected and served. In production Django does not serve static assets itself, so you run collectstatic and serve them through WhiteNoise or a proxy.
  • A production database. SQLite is fine locally, but production wants PostgreSQL with backups and pooling.
  • Migrations on every release. The database schema has to be brought up to date each deploy, before the new code starts taking traffic.

The two hosting models differ entirely in who does that work. On a VPS you do all of it by hand and keep doing it. On a managed platform most of it is either automatic or a single setting. The official Django deployment documentation is the authoritative reference for what production expects, and its deployment checklist is worth running through before any launch regardless of where you host.

Managed PaaS vs. VPS for Django

The choice is less about Django and more about how much operations work you want to own. Here is how the two models compare on the things that actually cost you time.

ConcernVPS (self-managed)Managed platform
App server (gunicorn/ASGI)You install and supervise itDetected and run for you
TLS and HTTPSConfigure certbot and renewalsAutomatic on every domain
DatabaseInstall and secure PostgreSQLManaged Postgres, one click
Static filesConfigure a proxy or WhiteNoiseWhiteNoise, no proxy needed
Migrations on deployWrite your own deploy scriptOne step in the start command
ScalingResize the box, add a load balancerManual scaling behind a built-in LB
OS and security patchesYour responsibilityHandled by the platform
Cost at restFixed monthly server feePlan fee with usage included, then per-minute overage
Best forFull control, learning the stackShipping and staying shipped

A VPS wins when you need root, custom system packages, or a very specific network layout, and when running the stack is part of what you want to learn. It loses on ongoing time: every patch, certificate renewal, and backup script is yours forever. A managed platform wins when your goal is a running application rather than a running server. If you want the broader picture of that tradeoff, what is a PaaS covers the model in depth.

Deploying Django Without Managing a Server

The rest of this guide uses the managed path, because the VPS path is mostly generic Linux administration. The pattern is: make three settings production-safe, tell the platform how to start the app, and let it build from your GitHub repository.

You need a Django project in a GitHub repository with a requirements.txt. If you are starting from scratch, these commands give you one with the packages this guide uses:

bash
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install django gunicorn whitenoise dj-database-url "psycopg[binary]"
django-admin startproject myproject .
pip freeze > requirements.txt

1. Bind to 0.0.0.0 and the port you expose

The single most common Django deploy failure is an app that starts fine but never receives traffic, because it is listening on the wrong address. Gunicorn binds 127.0.0.1 by default, which only accepts connections from inside the container. The platform routes traffic to the port you expose in the app's settings, so bind 0.0.0.0 on that port. This guide uses 8080.

For a standard synchronous Django app, run gunicorn against your WSGI entrypoint:

bash
gunicorn myproject.wsgi:application --bind 0.0.0.0:8080 --workers 3

If your app uses async views, Django Channels, or websockets, run an ASGI worker instead:

bash
gunicorn myproject.asgi:application \
  -k uvicorn.workers.UvicornWorker \
  --bind 0.0.0.0:8080 --workers 3

A common starting point for workers is (2 × CPU cores) + 1. Adjust it after you watch memory in the app's metrics.

Out Plane builds a repository with Buildpacks, which detects a Python project and installs from requirements.txt, or with your own Dockerfile. For Django the Dockerfile is the simpler choice, because it can run collectstatic during the build. It is also the default when you deploy from the CLI. This one collects static files and migrates before gunicorn starts:

dockerfile
FROM python:3.12-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# collectstatic imports settings.py, so give it placeholder values
RUN SECRET_KEY=build-only DATABASE_URL=sqlite:////tmp/build.db \
    python manage.py collectstatic --noinput

EXPOSE 8080

CMD ["sh", "-c", "python manage.py migrate --noinput && gunicorn myproject.wsgi:application --bind 0.0.0.0:8080 --workers 3"]

The placeholders matter. The settings below read SECRET_KEY and DATABASE_URL with os.environ[...], so without them the build stops with a KeyError. The real values arrive at runtime from the app's environment variables.

Out Plane has no separate release phase, so migrations run when the container starts, before gunicorn takes traffic. If you run more than one instance, drop migrate from the start command and run it once from the browser terminal, so two instances do not migrate the same schema at the same time.

With Buildpacks, put the start command in the Start command field instead. It runs as a direct exec, not through a shell, so wrap it in sh -c when it chains commands with &&:

bash
sh -c "python manage.py migrate --noinput && gunicorn myproject.wsgi:application --bind 0.0.0.0:8080 --workers 3"

2. Make settings.py read from the environment

Production settings should come from environment variables, never from committed literals. Three of them matter most: SECRET_KEY, DEBUG, and ALLOWED_HOSTS. Django will reject requests to any host not in that last list, so it has to include your production domain.

python
import os

SECRET_KEY = os.environ["SECRET_KEY"]
DEBUG = os.environ.get("DEBUG", "0") == "1"

# Include your production domain. On Out Plane the default is
# {app}-{port}-{team}.outplane.app, plus any custom domain you add.
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "").split(",")

CSRF_TRUSTED_ORIGINS = [
    f"https://{host}" for host in ALLOWED_HOSTS if host
]

Generate a SECRET_KEY locally:

bash
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

Set SECRET_KEY, DEBUG=0, and ALLOWED_HOSTS as environment variables in the console. Sensitive values can be marked as secrets so they are write-only after you save them, and Django reads them the same way regardless. CSRF_TRUSTED_ORIGINS is easy to forget and shows up as a 403 on your first form POST behind HTTPS, so wire it to the same host list.

3. Serve static files with WhiteNoise

In production Django hands static files off to something else. The lowest-friction option that needs no proxy is WhiteNoise, which serves compressed, cache-busted assets straight from the app process.

python
MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "whitenoise.middleware.WhiteNoiseMiddleware",  # right after security
    # ... the rest of your middleware
]

STATIC_URL = "/static/"
STATIC_ROOT = BASE_DIR / "staticfiles"
STORAGES = {
    "staticfiles": {
        "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
    },
}

Collect the files before the app serves traffic:

bash
python manage.py collectstatic --noinput

The RUN line in the step 1 Dockerfile does this during the build, so the files ship inside the image. That is the main reason to prefer the Dockerfile route for a Django app that serves its own static files.

For user-uploaded media that has to survive restarts, attach a persistent volume and point MEDIA_ROOT at its mount path. Static assets belong in the build; uploads belong on the volume.

4. Connect a managed PostgreSQL database

SQLite does not survive a redeploy and cannot be shared across instances, so production Django wants PostgreSQL. Provision a managed database and read its connection string from the environment. The cleanest way is dj-database-url:

python
import dj_database_url

DATABASES = {
    "default": dj_database_url.config(
        default=os.environ["DATABASE_URL"],
        conn_max_age=600,
        ssl_require=True,
    )
}

To create the database, open Create → Database in the console, pick a region and a PostgreSQL version (14 to 18), and create it. Frankfurt is the default region and the closest one to the app in Germany. When it is ready, copy the connection string from the Connection panel on the database's Overview and save it as DATABASE_URL in the app's environment variables. All connections require SSL, which is why the snippet sets ssl_require=True. Managed PostgreSQL on Out Plane includes automated backups, point-in-time recovery, read replicas, and connection pooling, so the database is not a second system you have to operate. If you want to start there before touching a paid tier, free PostgreSQL hosting compares the options and their limits.

5. Create the app and deploy

With those settings committed, create the app in the console:

  1. Pick the GitHub repository and the branch to deploy.
  2. Choose Dockerfile if you committed the one from step 1, or Buildpacks.
  3. With Buildpacks, paste the sh -c start command from step 1. With a Dockerfile, leave it empty.
  4. Expose port 8080 as a public HTTP port.
  5. Add SECRET_KEY, DEBUG, ALLOWED_HOSTS, and DATABASE_URL.
  6. Select Deploy app and follow the build log.

The platform builds the image, runs your start command, issues a TLS certificate, and routes the app's URL to it. The default URL has the form {app}-8080-{team}.outplane.app, so that is the first entry in ALLOWED_HOSTS. After this, every push to the connected branch deploys again. There is no cold start, so the first request after a quiet night is as fast as any other.

6. Add a custom domain

On the Domains page, select Add domain, enter the host, such as app.example.com, and connect it to the app's HTTP port. Create the DNS record the console shows: a CNAME for a subdomain, or an A record for a root domain. HTTPS is issued once DNS propagates. Then add the domain to ALLOWED_HOSTS, or Django answers it with a 400:

text
ALLOWED_HOSTS={app}-8080-{team}.outplane.app,app.example.com

Deploy from your terminal or a coding agent

With the repository on GitHub, the outplane CLI creates the same app from your terminal. It deploys from a GitHub repository, never a local folder, and builds from a Dockerfile by default, so commit the Dockerfile from step 1 before you push. Keep the secret key in single quotes, since generated keys contain characters the shell would otherwise expand.

bash
curl -fsSL https://outplane.com/install.sh | sh
outplane login
outplane app create mydjangoapp --repo your-user/my-django-app --branch main --port 8080:http:public \
  --env 'SECRET_KEY=paste-your-generated-key' --env DEBUG=0 --env 'DATABASE_URL=paste-your-connection-string'
outplane app get mydjangoapp --json --fields status,url
outplane env set ALLOWED_HOSTS=your-app-address.outplane.app --app mydjangoapp --deploy

Put the address that app get prints into ALLOWED_HOSTS, and keep --deploy on env set so the running app picks up the new value. The install script also adds the Out Plane skill to the coding tools it finds, so after a restart you can ask Claude Code, Codex, Cursor or OpenCode to deploy this project and the agent runs these commands itself, leaving you only the Approve click in the browser.

Troubleshooting

  • The deployment never finishes. Gunicorn is listening on 127.0.0.1 or on a different port than the one you exposed. Bind 0.0.0.0:8080 and expose 8080.
  • KeyError: 'SECRET_KEY' or 'DATABASE_URL'. The variable is missing. Add it in the app's environment variables. If it happens during a Dockerfile build, give collectstatic the placeholders shown in step 1.
  • ModuleNotFoundError. A package is missing from requirements.txt. Run pip freeze > requirements.txt locally and commit it.
  • A 500 error. Open Logs to read the Python traceback. Avoid turning on DEBUG on a public URL, because the error page shows your settings.
  • Static files return 404. Check that WhiteNoise sits right after SecurityMiddleware, STATIC_ROOT is set, and collectstatic ran.
  • The database connection fails. Copy the whole connection string again, including its SSL parameter, and keep ssl_require=True.

Scaling, Regions, and Data Residency

Once the app is live, hosting decisions become operational. Django scales horizontally well because a properly configured app keeps no state in the process: sessions live in the database or cache, uploads live on a volume or object store, and any instance can serve any request. On a managed platform you run several instances behind a load balancer that distributes traffic across them, and you adjust the instance count yourself as traffic changes, up to your plan's ceiling. Compute is metered by the minute on top of the plan fee, so you pay for the capacity you actually use rather than a fixed monthly box.

Where the app runs matters for data location. Every Out Plane application runs in Germany, so European data residency is the default for the app rather than a setting you have to hunt for. Managed PostgreSQL defaults to Frankfurt and can be created in other regions too, so keep it in Frankfurt and the application and its data stay on European infrastructure, which simplifies the data-residency conversation. Residency here is about where the bytes physically sit; it is not a legal jurisdiction or certification. The GDPR-compliant hosting in Europe guide covers the wider compliance picture.

Beyond the web process, a real Django deployment usually needs a couple of neighbors: a Redis instance for caching and Celery, and sometimes a background worker. You run Redis yourself as a container with a persistent volume, and additional services deploy from the same console, with internal networking, TCP ports, environment variables, deploy tokens, and a browser terminal for one-off manage.py commands all part of the platform rather than extra tools you bolt on.

Frequently Asked Questions

What is the best way to host a Django application in 2026?

The best Django hosting depends on how much operations work you want to own. A managed platform is the fastest path for most teams: it builds your repo, runs gunicorn or an ASGI worker, provisions PostgreSQL, and handles TLS, so you ship code instead of maintaining a server. A VPS is the better fit only when you need root, custom system packages, or a specific network topology.

Do I need gunicorn to deploy Django?

Yes, or an equivalent production server. Django's built-in runserver is explicitly for development and should never face the public internet. Use gunicorn for standard synchronous apps, and gunicorn with a uvicorn worker (or uvicorn directly) if you use async views, Channels, or websockets. Both must bind to 0.0.0.0 and the port you expose.

Why does my Django app return a 400 Bad Request in production?

Almost always because the request's host is not in ALLOWED_HOSTS. Django rejects any request whose Host header is not listed, returning a 400. Add your production domain to ALLOWED_HOSTS, and when serving over HTTPS behind a proxy, add the matching https:// origins to CSRF_TRUSTED_ORIGINS to avoid 403s on form submissions.

How do I run Django migrations on deploy?

Run python manage.py migrate --noinput before gunicorn starts. Out Plane has no separate release phase, so put it at the front of the start command with sh -c, or in the Dockerfile's CMD, and it runs on every deploy. If you run several instances, run it once from the browser terminal instead, so two instances do not race to migrate the same schema.

Can I run an async (ASGI) Django app in production?

Yes. Set ASGI_APPLICATION in settings, point your server at myproject.asgi:application, and run an ASGI-capable worker such as gunicorn -k uvicorn.workers.UvicornWorker. This is what you want for Django Channels, websockets, long-lived connections, or heavy use of async views. Synchronous apps are fine on plain gunicorn WSGI.

How do I serve static files when hosting Django?

Collect them with collectstatic during the build and serve them with WhiteNoise, which needs no separate proxy or CDN to get started. Add the WhiteNoise middleware right after Django's security middleware and set a manifest static-files storage backend for compression and cache busting. Keep user uploads separate on a persistent volume, since those change at runtime.

Which database should I use to host Django in production?

PostgreSQL. SQLite is convenient locally but does not survive a redeploy and cannot be shared across scaled instances. A managed PostgreSQL database gives you automated backups, point-in-time recovery, and connection pooling without operating the server yourself. Read the connection string from a DATABASE_URL environment variable and enable a bounded conn_max_age for connection reuse.

Is there a free way to host a Django app?

Not permanently. Out Plane has no free tier, but Starter and Pro both begin with a 14 day free trial, which is long enough to put a small Django app through a real workload before you commit. Starter is $9 per month with $9 of usage included, Pro is $29 per month with $15 included, and anything above that is metered on the same invoice; see pricing for current figures.

Ship Django, Not a Server

Django hosting comes down to who runs the machinery around your app. On a VPS you assemble and maintain gunicorn, TLS, PostgreSQL, static serving, and migrations by hand, and you keep maintaining them. On a managed platform those become a start command, a few environment variables, and a migrate step, and the platform handles the rest, including HTTPS, scaling, and patches.

If your goal is a live Django app rather than a server to babysit, set ALLOWED_HOSTS, point gunicorn at 0.0.0.0:8080, attach a managed database, and deploy. Create your app in the console, start with the 14 day trial, and move to paid capacity in place when the traffic arrives.


Tags

django
python
hosting
paas
deployment
gunicorn

Next steps


Related reading


Start deploying in minutes

Connect your GitHub repository and deploy your first application today. Start with a 14-day free trial.

Start 14-day free trial