flask 使用模板出错

在flask中使用模板时,出现如下报错:

TypeError: 'NamedSignal' object is not callable

给出目录结构:

blog\
app\
    static\
    templates\
        index.html            
    __init__.py
    views.py
run.py

给出views.py代码:

# -*- coding:utf-8 -*-
from flask import template_rendered
from app import app

@app.route('/')
def index():
    title = '我是title'
    content = '我是内容'
    return template_rendered('index.html', title = title, content = content)

一直报错,不使用模板就可以正常。这个会是什么原因?求助!!!

阅读 5.5k
1 个回答

同学。。。是rendertemplate,不是templaterendered...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题