Flask 使用参数调用本地主机服务器
我正在端口81上运行Flask服务器。我希望我的服务器在Flask 使用参数调用本地主机服务器,flask,Flask,我正在端口81上运行Flask服务器。我希望我的服务器在/处显示正常页面,在/debug处显示调试页面。当我进入localhost:81时,我会看到正常页面。当我尝试导航到localhost\debug:81或localhost/81:81时,我收到一个“未找到”错误。我做错了什么 app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/d
/
处显示正常页面,在/debug
处显示调试页面。当我进入localhost:81
时,我会看到正常页面。当我尝试导航到localhost\debug:81
或localhost/81:81
时,我收到一个“未找到”错误。我做错了什么
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/debug')
def index_debug():
return render_template('index.html', debug=true)
您必须具有如下项目结构:
index.py
模板/
index.html
您在浏览器中使用的URL必须是localhost:81/debug,对于调试端点,您也尝试了它。它没有工作,我仍然得到“未找到”错误