尝试加载我的主页并出现构建错误,它无法为端点“Myview.general”构建 url,这在今天之前的 2 个月内运行良好,
视图.py
class Myview(BaseView):
route_base = "/home"
@has_access
@expose('/general', methods=['GET', 'POST'])
@appbuilder.app.route('/general', methods=['GET', 'POST'])
def general(self):
if request.method == 'POST':
bucket = request.form['bucket']
session['bucket'] = bucket
return redirect(url_for('HomeView.files'))
else:
buckets = get_buckets_list()
return render_template(
'index.html',
base_template=appbuilder.base_template,
appbuilder=appbuilder,
buckets=buckets
)
HTML 片段
<form class="select-bucket" action="{{ url_for('HomeView.general')}}" method="post">
<input type="hidden" name="bucket" value="{{ bucket['Name'] }}"/>
<button type="submit" class="btn btn-primary btn-sm">
<i class="fa fa-folder-open"></i>
</button>
</form>