Skip to content

Zero-configuration Django support

Authors

1 min read

Django, one of the most popular high-level Python web frameworks, for rapid development, is now supported with zero-configuration. You can now instantly deploy Django full-stack apps or APIs on Vercel.

Vercel now recognizes and deeply understands the specifications of Django applications, removing the need for redirects in vercel.json or using the /api folder.

All applications on Vercel use Fluid compute with Active CPU pricing by default. Static files will be served by the Vercel CDN.

Deploy Django on Vercel or visit the Django on Vercel documentation

Link to headingExample Django app

CLI entry point

manage.py
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

Project settings

app/settings.py
SECRET_KEY = "my-secret-key"
DEBUG = False
ALLOWED_HOSTS = ["localhost", "127.0.0.1", ".vercel.app"]
ROOT_URLCONF = "app.urls"
WSGI_APPLICATION = "app.wsgi.application"
INSTALLED_APPS = ["app"]

URL routing table

app/urls.py
from django.urls import path
from app.views import index
urlpatterns = [
path("", index),
]

Request handlers

app/views.py
from django.http import HttpResponse
def index(request):
return HttpResponse("<html><body>hello, world!</body></html>")

WSGI entry point

app/wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
application = get_wsgi_application()