小编ron*_*wag的帖子

Flask render_template()返回"NameError:name'app'未定义"

我正在关注Flask快速入门指南.http://flask.pocoo.org/docs/quickstart/#static-files 我按照指南得到了这个错误.

/application
/__init__.py
/templates
    /hello.html

   @app.route('/hello/')
   @app.route('/hello/<name>')
   def hello(name=None):
       return render_template('hello.html', name=name)

    >python _init_.py 
        Traceback (most recent call last):
        File "_init_.py", line 4, in <module>
   @app.route('/hello/')
   NameError: name 'app' is not defined
Run Code Online (Sandbox Code Playgroud)

python flask

13
推荐指数
4
解决办法
3万
查看次数

标签 统计

flask ×1

python ×1