我正在将一个虚拟网页项目从标准的app.route配置转换为使用flask.Blueprint,它现在在盈阳上生成404个错误,我无法修复
以下是我的应用程序代码:
app = flask.Flask(__name__)
def main():
register_blueprints()
app.run(debug=True)
def register_blueprints():
from inspection_com.views import home_views
from inspection_com.views import donation_views
from inspection_com.views import employee_views
app.register_blueprint(home_views.blueprint)
app.register_blueprint(donation_views.blueprint)
app.register_blueprint(employee_views.blueprint)
if __name__ == '__main__':
main()
以下是我的一个视图,称为home_视图:
from inspection_com.infrastructure.view_modifiers import response
blueprint = flask.Blueprint('home', __name__, template_folder='templates')
@blueprint.route('/')
@response(template_file='home/index.html')
def index():
return {}
@blueprint.route('/about')
@response(template_file='home/about.html')
def about():
return {}
当我从主app.py文件调用app.route(“/”)时,路由和响应代码都没有改变
任何帮助都将不胜感激。当我认为我没有做任何明显错误的事情时,我试图解决这个问题,有点发疯了
-凯文
目前没有回答
相关问题 更多 >
编程相关推荐