import os from flask import Flask, render_template, send_from_directory app = Flask(__name__) # 配置 Jinja2 使用不同的定界符,避免与 Vue.js 的 {{ }} 冲突 app.jinja_env.variable_start_string = '[[' app.jinja_env.variable_end_string = ']]' app.jinja_env.block_start_string = '[%' app.jinja_env.block_end_string = '%]' @app.route('/') def index(): return render_template('index.html') @app.route('/static/') def send_static(path): return send_from_directory('static', path) if __name__ == '__main__': app.run(host='0.0.0.0', port=7860)