Yash Makan
Yash Makan

Yash Makan

4 best python web app hosting services for free(with the complete process)

4 best python web app hosting services for free(with the complete process)

Yash Makan's photo
Yash Makan
·Nov 26, 2021·

5 min read

Subscribe to my newsletter and never miss my upcoming articles

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

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 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.
Trulli bye-bye localhost

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

0. Vercel (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

✅ 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

✅ 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

✅ 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/ and make sure npm is accessible from your terminal by npm -v
  2. Download vercel cli using npm i -g vercel. Refer here
  3. add requirements.txt file with all the python packages mentioned you've used.
  4. Create your account on 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)
{
  "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

  2. open terminal at the root of the project.

  3. Type the below commands

    Vercel in cmd

    Vercel commands

  4. And there you have it. visit 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. 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/ 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, so that we can discuss more about tech there. Hope to be in your mind again, till then b-bye!

bye bye

Socials

 
Share this