Hosting Flask and Node WebApp for free - Heroku Alternative

Flask

Heroku is a great platform unless your web app becomes big or if you don’t want to get into the hassle of environment and workers setup. (Altho it’s quite not a big deal)

So, some of you may surely be thinking about any “free” alternative to Heroku!

Here, I will tell you about one site which is free and provides a lot of features to make your web app online in few minutes or less.

Deta.sh

Deta.sh

Hold up! Don’t see the Pricing tab (as it's free forever!)

Deta was developed by developers for developers, students, hackathon participants, etc.

The parent company is based in Berlin, Germany.

Let’s come to its feature part.

Features

Features Deta.sh

So the first feature is “Deta Micros”.

Deta Micros are like small instances where you can host your nodejs web app or any other python web app

And Second “Deta Base”.

The name is quite enough to explain itself.

Again as the name says, it’s for hosting images and files on their server which you can, later on, integrate into your web app.

Cons

So, now after discussing all this you may be thinking about the cons.

Altho the site provides everything for free and is quite good for newcomers to web development but it lacks more advanced settings and features. And Django web app is still not directly supported.

But cmmon this site is meant for those who want easiness right?

Let’s come to the interesting part! Hosting a web app.

Hosting Your Web App

Here, we will install a flask webapp.

Step 1. Make an account on deta.sh

So, the first and the foremost. Make an account on deta.sh.

Step 2. Setting up their client.

After signup, you will arrive at a handy dandy portal with few starter tips.

Click on Deta Micros (if you aren’t already there). Click on Windows(or Mac/Linux if you are on those systems) and copy the command.

Open your terminal as stated there like in the case of windows open Powershell.

Paste the command there and wait for some moment to let it download the client and install it.

Step 3. CLI Login

In the same terminal type

deta login

It will pop up a browser window where you need to login into your deta.sh account.

Step 4. Creating WebApp

Choose where you want to keep your code files.

Switch to that directory and open VScode there (VScode ❤️).

In the terminal in VSCode type

deta new --python myApp

(Change myApp to anything you want)

Step 5. requirements.txt

cd into the directory or manually create a requirements.txt inside the myApp folder.

Paste all the requirements which we will need.

Like

flask

Altho you can add anything but we are building a Flask app, right?

Step 6. Coding

Cmmon this you can do on your own. Add your code in main.py file.

Here’s a small snippet of “Hello World” (enjoy 🍻)

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"

Step 7. Deploying

deta deploy

then

deta auth disable

(This will make it public)

and then go to the site

If you forget the site details just type

deta details

Kudos! 🎉 Your Flask server is online!

Note: Currently there is no direct way to host a Django WebApp on Deta. Altho there is some workaround but still I don't recommend hosting Django Webapp on Deta.

Thanks for reading patiently and coming to this part! Feel Free to add a comment!

If you liked the post add a 👏 to keep me motivated!

Github: https://github.com/AmreshSinha

Linkedin: https://www.linkedin.com/in/aps-amresh/

Learning DL | Knows some WebD, AppD and ML | Sophomore IITG