我正在Flask应用程序中的<iframe>
中呈现应用程序
localhost链接是http://localhost:8000/dashboard2/
,并将其推送到AWS Elastic Beanstalk
托管在:http://server-name.elasticbeanstalk.com/dashboard2
我的应用程序是用python编写的,jinja模板呈现应用程序
{
{% 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模板中访问和打印环境
我会在运行应用程序时设置一个环境变量,指定应用程序是以
development
还是production
模式运行:然后,在模板文件中,您可以通过应用程序的
config
访问环境,并根据值呈现不同的内容:相关问题 更多 >
编程相关推荐