Setup VirtualEnv, Flask Installation and Project Directory
pip3 install virtualenv
virtualenv -p /usr/bin/python3 flask-sample
source flask-sample/bin/activate
pip install flask
mkdir flask-demo && cd flask-demo
touch main.py
Edit main.py file
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello World!"
if __name__ == '__main__':
app.run()
Run Flask app and visit localhost:5000
python main.py
Console Log * Serving Flask app "main" (lazy loading) * Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead. * Debug mode: off * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
NGROK Setup
Signup for NGROK and get AuthToken
Console Logwget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
./ngrok authtoken
./ngrok http 5000
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account Ashish Tiwari (Plan: Free)
Version 2.3.25
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://b6ad4280.ngrok.io -> http://localhost:5000
Forwarding https://b6ad4280.ngrok.io -> http://localhost:5000
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
App is running on http://b6ad4280.ngrok.io
0 Comments:
Post a Comment