【发布时间】:2021-10-11 00:47:58
【问题描述】:
我正在我的 Flask 应用程序中以 <iframe> 呈现应用程序。
本地主机链接是http://localhost:8000/dashboard2/,并将其推送到AWS Elastic Beanstalk,托管在:http://server-name.elasticbeanstalk.com/dashboard2
我的应用程序是用 python 编写的,dashboard.html jinja 模板呈现应用程序。
dashboard.html的内容:
{% extends "base.html" %}
{% block content %}
<div class="embed-responsive embed-responsive-16by9">
<iframe loading="lazy" class="embed-responsive-item" src="http://localhost:8000/dashboard/" width="100%" height="600"></iframe>
</div>
{% endblock %}
问题是,我如何检查环境类型 os 并在 localhost 或 production 上呈现应用程序?我需要在.html 模板中执行此操作。
有没有办法访问和打印jinja模板中的环境?
【问题讨论】:
标签: python html flask amazon-elastic-beanstalk jinja2