from flask import Flask, render_template
from flask_cors import CORS #pip install flask-cors
app = Flask(import_name=__name__, static_url_path='/',
static_folder='static', template_folder='templates')
CORS(app) #设置允许跨域
# 添加html访问路由
@app.route('/')
def index():
return render_template('index.html')
# 添加html访问路由
@app.route('/<file>')
def blog(file):
return render_template(file)
if __name__ == "__main__":
app.debug = True
app.run(host="0.0.0.0") # 默认设置host:0.0.0.0 port:5000
posted on
浙公网安备 33010602011771号