Skip to content

Instantly share code, notes, and snippets.

@huangrh
Forked from CognitiveDave/web.py
Created March 3, 2021 05:10
Show Gist options
  • Save huangrh/a00067df4ce777a01f626e20f57e7ed7 to your computer and use it in GitHub Desktop.
Save huangrh/a00067df4ce777a01f626e20f57e7ed7 to your computer and use it in GitHub Desktop.
A python flask backend
from flask import Flask, render_template, g, jsonify, request, redirect, url_for, session, flash
from gensim import corpora
import os
app = Flask(__name__,
static_folder = "./dist/static",
template_folder = "./dist")
@app.route("/home")
def hello():
return "Hello World from Flask"
@app.route('/')
def home():
return render_template("index.html")
port = os.getenv('PORT', '5006')
if __name__ == "__main__":
app.run(host='0.0.0.0', port=int(port),debug=True)
#serve(app, url_scheme='http', threads=4, port=int(port))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment