2024-09-22 16:43:29 发布
网友
我正在使每一条路通向索引.html,因为它是一个单页应用程序。我制作了一个名为mod的蓝图,并使用flask restful将所有restul api放在那里
@mod.route('/') @mod.route('/<path:p>') def home(p=0): return render_template('index.html')
这样做对吗? 我不太关心p=0部分。 变量p从未使用过,但必须存在,因为它必须接收路径变量p
你的路线当然是合理的。你知道吗
更简单/易读的方法可能是:
@mod.route('/') @mod.route('/<path>') def home(*args, **kwargs): return render_template('index.html')
从效率的角度来看,完全在web服务器(nginx/apache/whatever)上处理这个问题可能更好。你知道吗
你的路线当然是合理的。你知道吗
更简单/易读的方法可能是:
从效率的角度来看,完全在web服务器(nginx/apache/whatever)上处理这个问题可能更好。你知道吗
相关问题 更多 >
编程相关推荐