## How it Works Our Django application, `example` is configured as an installed application settings.py`: ```python # settings.py INSTALLED_APPS = [ # ... 'django_app', ] ``` We allow subdomains in `ALLOWED_HOSTS`, in addition to 127.0.0.1: ```python # settings.py ALLOWED_HOSTS = ['127.0.0.1'] ``` The `wsgi` module must use a public variable named `app` to expose the WSGI application: ```python # wsgi.py app = get_wsgi_application() ``` The corresponding `WSGI_APPLICATION` setting is configured to use the `beckend'` variable from the module: ```python # vercel_app/settings.py WSGI_APPLICATION = 'vercel_app.wsgi.beckend' ``` There is a single view which renders the current time in `example/views.py`: ```python # django_app/views.py from datetime import datetime from django.http import HttpResponse def index(request): now = datetime.now() html = f'''
The current time is { now }.
''' return HttpResponse(html) ``` This view is exposed a URL through `example/urls.py`: ```python # django_app/urls.py from django.urls import path from django_app.views import index urlpatterns = [ path('', index), ] ``` Finally, it's made accessible to the Django server inside `urls.py`: ```python # vercel_app/urls.py from django.urls import path, include urlpatterns = [ ... path('', include('django_app.urls')), ] ``` This example uses the Web Server Gateway Interface (WSGI) with Django to enable handling requests on Vercel with Serverless Functions. ## Running Locally ```bash python manage.py collectstatic python manage.py runserver 8090 docker rmi -f