How to Host Your Django App for Free on Vercel
If you’ve built a portfolio or prototype application with Django, hosting it for free on Vercel is just a few clicks and a small chunk of code away. Heroku used to be a lifesaver, but it stopped offering free hosting in 2022.
Sign up forfree
Forgot your password?
Create an account
*Required: 8 chars, 1 capital letter, 1 number
By continuing, you agree to thePrivacy PolicyandTerms of Use.You also agree to receive our newsletters, you can opt-out any time.
Configure Your Django App for Vercel
You’ll need to configure a few aspects of your Django project before you can deploy it to Vercel.
Configure the vercel.json File
First, you need to create a vercel.json file in your project’s root folder to point Vercel to your app’s web server gateway interface (WSGI):
Replacedjango_app_namewith your Django app’s name (the same as the folder that contains thesettings.pyfile).

Refactor the wsgi.py File
Vercel doesn’t recognize theapplicationvariable in the wsgi.py file. Thankfully, the only change you’ll make to solve this problem is to pass theapplicationvariable into Vercel asapp.
So refactor your app’swsgi.pyfile as shown:

Connect to a Remote Database
If your app needs database support, use Vercel’s provision or spin up an external database instance somewhere. Thankfully, there are manyfree PostgreSQL databaseoptions online. You can alsoconnect to a MongoDB clusterif you prefer a NoSQL database.
However, we’ll stick to Railway’s PostgreSQL database cluster here since it offers a starter credit and is easy to set up.

To set up a PostgreSQL instance on Railway:
Considermasking these secret variablesusing a.envfile to beef up your Django app’s security. Besides, Vercel allows you to list your environment variables during deployment.

So once you use theos.getenvmethod, Python fetches the specified variable from the Vercel hosting environment. Thus, your database setup becomes:
Deploy Your GitHub Repository on Vercel
The second part of this process involves pointing Vercel to your repository on GitHub. Once you’ve done so, your app will be live, and anyone can access your website at a URL that Vercel generates.
Create a Requirements File
Vercel tries to find and install your project’s dependencies inside therequirements.txtfile during deployment. However, remember that writing dependencies from avirtual environmentintorequirements.txtis always easier than from the global space.
Create a requirements.txt file in your project root folder using the following command via the terminal:
Connect Your Repository to Vercel
Vercel works by tracking changes in a repository. So the first deployment step is topush your code to GitHubor any other version control system that works best for you. Ignore this step if your code is already on GitHub.
To get started on Vercel:
Once deployed, Vercel tracks subsequent changes pushed to the main branch to reflect them in the live version. Hence, you only need to deploy your changes to GitHub to upgrade your app in real-time.
While Vercel auto-generates a URL for your Django website, you can also deploy using a customized domain name. So considerbuying a domain name from a registrarif you need one.
Host Your Django Website at No Cost
Sometimes, it takes more than a GitHub repository to impress potential employers and clients. While a strong and coherent repository shows your competence, displaying a live version of your portfolio or project prototype presents you as an achiever.
Hosting a project that doesn’t generate revenue is often discouraging. But thankfully, Vercel is one of the few free web hosting services. And you’ve seen how to deploy your Django project for free on the platform. Although the generated URL looks untidy, you can paste it into your project’s ReadMe on GitHub to show people how your creation works.
Tell the world about your projects and achievements with a GitHub profile README.
Freeing up vital memory on Windows only takes a moment, and your computer will feel much faster once you’re done.
Your phone’s camera app doesn’t show this, so it’s easy to miss.
Some subscriptions are worth the recurring cost, but not these ones.
Obsidian finally feels complete.
You’re not getting the most out of what you pay for iCloud+.