Missing variable `handler` or `app` in file "project/wsgi.py"

Viewed 15

I have been trying to deploy my Django app to Vercel and I am getting this error. Any idea?

Missing variable `handler` or `app` in file "qr_project/wsgi.py".
1 Answers

So I found out that vercel looks for app not application (which is comes default with django-admin startproject mysite). So I changed my wsgi.py file like this

import os

from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_project.settings')
application = get_wsgi_application()
app = application
Related