首页 > 解决方案 > Django拒绝连接没有HTTP协议的HTML

问题描述

嗨,我希望在我的 django 中使用 IFRAME HTML 代码,但不幸的是它无法显示包含。

模板.html

<iframe id="inlineFrameExample"
title="Inline Frame Example"
width="300"
height="200"
src="https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik">
</iframe> 
<iframe id="inlineFrameExample"
title="Inline Frame Example"
width="300"
height="200"
src="C:/Graph/GraphCombine/templates/T.html">
</iframe>

对于第一个 IFRAME 它可以工作,但是对于第二个 iframe,内容没有显示出来,任何人都可以分享我的想法吗?

编辑

我已经通过以下代码解决了上述问题

src="{% static 'A.html' %}"

但我面临另一个问题,即 html 文件将来未知,所以我将 html 文件循环到数组中并通过以下代码传递给 html:

graph=['A.html']
{% for i in graph %}
src="{% static '{{i|safe}}' %}" 
{% endfor %}

但我得到错误

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

请帮忙,谢谢

标签: htmldjangopython-3.xiframe

解决方案


推荐阅读