步驟一:安裝 flask
!pip install flask
步驟二:引入 flask
from flask import Flask, request
步驟三:路由撰寫
app = Flask(__name__)
# Define Flask routes
@app.route("/")
def index():
return "Hello World"
步驟四:啟用 server 及對外連線
import multiprocessing
proc = multiprocessing.Process(target=app.run, kwargs=dict(use_reloader=False))
proc.start()
!ssh -o "StrictHostKeyChecking no" -R 80:localhost:5000 serveo.net
proc.terminate()