不需要把电脑盘写出来,template_folder是用来指定模板文件所在的文件夹路径。可以是相对路径或绝对路径。例如:

from flask import Flask, render_template

app = Flask(__name__, template_folder='templates')

@app.route('/')
def index():
    return render_template('index.html')

在上面的代码中,template_folder被设置为'templates',这意味着模板文件应该放在项目根目录下的'templates'文件夹中。如果你的模板文件在其他地方,你需要相应地更改template_folder的值。

在pycharm中需要把电脑盘写出来吗template_folder=

原文地址: https://www.cveoy.top/t/topic/fsyT 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录