Google Colab
How to Install & Run Python Flask in Google Colab with Ngrok | Step-by-Step Guide
October 13, 2024
0
, , ,

In this video, I’ll show you how to install and run a Python Flask web application in Google Colab and expose it to the internet using Ngrok. Learn how to set up Flask, handle Ngrok for public URLs, and test your Flask app live. This tutorial is perfect for Python developers who want to quickly deploy their Flask apps in a cloud environment using Colab. Follow the easy, step-by-step instructions and start building your Flask applications right in your browser!

🚀 In this video, you will learn:

  • How to install Flask in Google Colab
  • How to authenticate and configure Ngrok
  • How to run and access your Flask app using a live Ngrok URL

First Create an Account in ngrok:
https://dashboard.ngrok.com/domains

 

You will get authentication token here: https://dashboard.ngrok.com/get-started/your-authtoken

Create a domain here to public url: https://dashboard.ngrok.com/domains

Then in your Google Colab, execute the below command, check the youtube video (https://youtu.be/4DbVWtqAVjw):

!pip install flask-ngrok
!pip install pyngrok
# Authenticate Ngrok
#!ngrok authtoken ‘XXXXXYYYYY’
!ngrok authtoken XXXXXYYYYY
# Create Flask app
from flask import Flask
app = Flask(__name__)
@app.route(‘/’)
def home():
return”Hello World in Python Flask Era”
# Expose the Flask app via Ngrok
from pyngrok import ngrok
# Create a tunnel to the Flask app
public_url = ngrok.connect(5000)
print(“Ngrok tunnel URL:”, public_url)
# Run Flask app
app.run()

About author

ZERIN

CEO & Founder (BdBooking.com - Online Hotel Booking System), CEO & Founder (TaskGum.com - Task Managment Software), CEO & Founder (InnKeyPro.com - Hotel ERP), Software Engineer & Solution Architect

There are 0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *