繁体   English   中英

Flask render_template S3中的HTML

[英]Flask render_template where HTML is in S3

我可以将存储在S3中的模板发送到render_template吗?

application_root = config.get_application_root()
static_folder = os.path.join(application_root, 'static')
template_folder = os.path.join(application_root, 'templates')
app = Flask(__name__, static_url_path='/static', static_folder=static_folder, template_folder=template_folder)

一种简单的解决方案是将s3对象下载到服务器目录,然后指向render_template从该目录中进行选择。

我想知道是否需要这个中间步骤。 我已经将web_content传递为预构建的HTML文件,并且不生成它们。 是否可以在没有实际HTML文件的情况下将HTML作为字符串发送到render_template?

/flask_folder 
----/app.py
----/templates/
----/static/

/my_external_template_folder

使用render_template_string代替render_template

http://flask.pocoo.org/docs/1.0/api/#flask.render_template_string

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM