How to dynamically select template directory to be used in flask?

后端 未结 3 1381
生来不讨喜
生来不讨喜 2020-11-30 03:06

By default flask uses template files stored in \"template\" directory :

/flaskapp
    /application.py
    /templates
        /hello.html

Is

3条回答
  •  时光说笑
    2020-11-30 03:16

    You can pass the Flask constructor a "template_folder" argument.

    Like so...

    Flask(__name__, template_folder="wherever")
    

    Here's the documentation: http://flask.pocoo.org/docs/api/

提交回复
热议问题