Tech Monger

Programming, Web Development and Computer Science.

Skip to main content| Skip to information by topic

How to Deploy Web Application from Home

If you want to host web application from home computer or with raspberry pi then you can use free and open source software Localunnel. Localtunnel is simple to use and works behind Network Address Translator (NAT) which means it does not require you to have Public IP. Nor it assumes you to have control over firewall configuration of router. In this tutorial we will demonstrate it by building simple python web application in flask and host it using Gunicorn. However if you have static website or dynamic web application running on Apache, NGNIX or Microsoft IIS locally then you can also follow along by directly jumping to the exposing web app section.

Building Simple Flask Web Application

We will create simple Hello Localtunnel application with following flask code.
from flask import Flask
app = Flask(__name__)

def hello():
    return "Hello Localtunnel"

if __name__ == "__main__":

Local Deployment with Gunicorn

We will need full fledged web server to host flask application because development server werkzeug will not able to handle too many requests. If you are just exploring this hosting option then you can skip gunicorn deployment and go ahead by deploying app with default flask web server werkzeug.

Install Gunicorn
pip install gunicorn
Deploy WSGI instance with Gunicorn
gunicorn -b web_app:app

With above command flask application will run on default port 8080 with gunicorn as web server.

Host Web Application with Localtunnel

Once your web server started serving web application on local computer you can expose it publicly with localtunnel.

If you have not already installed localtunnel client first Install Localtunnel. Note that localtunnel is available on all platform including windows.

Use following client command to expose web application on default localtunnel server at

lt -p [source-port] -s [subdomain]

source port is the port on which your web application is running.
subdomain is the name that you would like to host your app with

For example below command will expose application running locally on port 8080 with name awesomeapp at

lt -p 8080 -s awesomeapp

Note that this subdomain for app will be freely provided and same will be printed on command line output.

Localtunnel server will make use of HOST header in HTTP request to identify your web application from other apps hosted at

If you want to get familiar with other localtunnel client commands then you can read localtunnel client commands and options.


  • Using localtunnel you can quickly share home web server with world over Internet.
  • Eliminates need of cloud based server or hosting.
  • Eliminates need of static public ip address.
  • More control over your data.
  • But you would need to keep local computer always up and running with reliable network connectivity. Raspberry pi is good option.
  • If local web server crashes then you would need to restart it and register subdomain again with localtunnel client.
  • It is worth noting that though your application will be served over HTTPS there wont be encryption available between home server and localtunnel server.

Tagged Under : Flask Linux Localtunnel Open Source Python Raspberry Pi Ubuntu Web Windows