How to Deploy Django on Vercel for Free

How to Deploy Django on Vercel for Free

How to Deploy Django on Vercel for Free

If you're seeking for a cost-effective and user-friendly hosting service, deploying a Django application with Vercel is a fantastic choice. An instruction manual for deploying your Django application in Vercel is provided here.

 

# 1

First need to install django package

 

pip install django

 

# 2 

Create new Django Project (project name "deploy")

 

django-admin startproject deploy

 

# 3

go to deploy/settings.py

 

ALLOWED_HOSTS = ['127.0.0.1', '.vercel.app']

 

# 4

Go to deploy/wsgi.py

 

application = get_wsgi_application()
app = application

 

# 5 

Create .vercel.json in home directory

 

{
  "builds": [
    {
      "src": "deploy/wsgi.py",
      "use": "@vercel/python"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "deploy/wsgi.py"
    }
  ]
}

 

# 6

Create requirements.txt file

 

pip freeze > requirements.txt

 

# 7

Run Deploy Command

 

vercel deploy

 

FAQ

Can I deploy a Django website on Vercel?

Yes, you can deploy a Django website on Vercel. Vercel is primarily known for hosting static websites, but with the help of serverless functions, you can deploy Django applications as well. By combining Vercel's hosting capabilities with Django's powerful web framework, you can create and deploy dynamic websites on the Vercel platform.

Share