4 Free hosting platforms for python web app with step-by-step process
Tags: python, beginners, tutorial, webdev
Published: 2021-11-26 06:43:07

Hi developers, I am Yash Makan and in today's post, we are going to discuss 4 platforms where you can host your flask or Django app. If you've completed a website or API using python or planning to create one then this post is so right for you. Also, read till the end as in the end, I am going to explain step by step the complete process of uploading your web app to the internet. So without any further ado let's start!

![https://i.giphy.com/media/dpsUFSR9ZHjwfrVAg9/giphy.webp](https://i.giphy.com/media/dpsUFSR9ZHjwfrVAg9/giphy.webp)

## What is a hosting platform and why do I need one?

Alright! If you have developed a web app then you might know that all these apps whether made with Django or flask run on localhost. A localhost is a place where you can run your code and view it in your browser. But when you complete the development of your web app then it might be time to publish your app on the internet so that anyone can access your websites. A web app setup locally can be viewed by you but your friends won't be able to see your amazing work. There are two options you can opt-in these situations.

- One is to connect your localhost with a tunnel using ngrok. Ngrok exposes your localhost to the internet so that everyone can access it by a specific URL provided by it. I don't recommend this way if you want your website 24x7 as you have to run your program 24x7 which is quite not the case but if you just want to share your localhost for some time and you don't want the connection to be connected then you can choose this method. For more info, you can read it [here](https://dev.to/drsimplegraffiti/ngrok-expose-a-local-web-server-to-the-internet-4m67) by Abayomi Ogunnusi.
- The second way is to host your code to someone else's server. This someone else server is what we call the hosting platform. Here these servers run your code 24x7 at some specific domain. So if you want to host then below are your best options according to me.

<figure>
  <img src="https://media3.giphy.com/media/COAg7vjpWW8Ja/giphy.gif?cid=ecf05e47akugdyaqluoi5847vpgh9uw34nt71j11s3nxw8b4&rid=giphy.gif&ct=g" alt="Trulli" style="width:100%">
  <figcaption>bye-bye localhost</figcaption>
</figure>

> Below all the links are compared based on their hobby or free packs
> 

## 0. Vercel [↗](https://vercel.com/) (full step-by-step procedure at the end)

✅ Git connect

✅ Custom domain

✅ CLI available

✅ deploy and manage multiple versions 

✅ deploy ease

✅ HTTPS/SSL

No Project limit

32 deployments every 1 hour

## 1. qovery [↗](https://www.qovery.com/)

✅ Git connect with auto-deploy

✅ Great community support with discord

✅ HTTPS/SSL

✅ Inbuilt database integration like PostgreSQL, MySQL

✅ CLI available

up to 3 projects with 100 applications

According to my personal experience, it's a little tricky to deploy the web app on qovery

100 deployments a month

## 2. pythonanywhere [↗](https://www.pythonanywhere.com/)

✅ Git connect

✅ deploy ease

✅ HTTPS/SSL

CLI is not available

No custom domain

You cannot deploy and manage multiple versions of your web app

You can make one project per account

There is internet outbound so you won't be able to scrape most of the websites you want to.

## 3. Heroku [↗](https://www.heroku.com/)

✅ Git connect and deploy

550-1,000 dyno hours per month

5 apps(unverified accounts) & up to 100 apps(verified accounts)

web app sleeps when no activity detects

It's not that easy to deploy like others on the list

## My Recommendations

`Vercel` is the winner for sure for me. It has everything for free that I want and I will recommend vercel to you guys as well. 

## How can I deploy my flask web app on vercel?

1. download node from [https://nodejs.org/en/](https://nodejs.org/en/) and make sure npm is accessible from your terminal by `npm -v`
2. Download vercel cli using `npm i -g vercel`. Refer [here](https://www.npmjs.com/package/vercel)
3. add `requirements.txt` file with all the python packages mentioned you've used.
4. Create your account on [https://vercel.com/](https://vercel.com/). It's pretty straightforward...
5. add `vercel.json` file and add the below content(here I am using app.py as my main file)

```python
{
  "version": 2,
  "builds": [
      {
          "src": "*.py",
          "use": "@liudonghua123/now-flask"
      }
  ],
  "routes": [
      {
          "src": "(.*)",
          "dest": "app.py"
      }
  ]
}
```

1. make sure your project looks something like this
    
    ![Project structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x212ogw561dpe3bhan1n.png)
    
2. open terminal at the root of the project.
3. Type the below commands
    
    ![Vercel in cmd](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kbylguvtmjqef6kqi0v5.png)
    
    ![Vercel commands](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ysrgmob2jmjrr9no0k2.png)
    
4. And there you have it. visit [vercel.com](http://vercel.com) and open your project. Click the visit button and your website is live. 
5. to later update just use `vercel --prod` to push your code to production level.

## Conclusion

So you see, it's that easy to upload your web app to the web for free in just 2 to 5 minutes. For this blog post, I have used the web template from this [repo](https://github.com/StartBootstrap/startbootstrap-one-page-wonder). If you want the complete code then visit

{% github YashMakan/vercel_python_deploy %}

I have deployed the website to [https://vercel-python-ten.vercel.app/](https://vercel-python-ten.vercel.app/) if you want to check out. I hope you liked my blog and if this article adds any value then it would be great if you leave a like and make sure to bookmark it as well. Also, share the post with your friends so that they too can learn something new(don't be selfish...). Also if possible you can follow me on [twitter](https://twitter.com/Yash_Makan), so that we can discuss more about tech there. Hope to be in your mind again, till then b-bye!

![bye bye](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p5dni43983zjpi94dmmn.gif)

## Other Articles

- [18 Python one-liners that will speed up your coding process.](https://dev.to/yash_makan/18-python-one-liners-that-will-speed-up-your-coding-process-21md)
- [AI bot that could answer your questions](https://dev.to/yash_makan/ai-bot-that-could-answer-any-questions-asked-gmn)
- [Generate your own favourite TV episode using python](https://dev.to/yash_makan/generate-your-own-favourite-tv-episode-using-python-1pb3)

## Socials

- [My Website](https://www.yashmakan.co.in/)
- [Twitter](https://twitter.com/Yash_Makan)
- [Banner](https://www.yashmakan.co.in/banner)