我想把一个svg文件作为xml元素嵌入到我的页面中(不是作为图像),我需要这样做才能在页面内动态更改元素。
我写了一段简单的代码,希望它能实现:
@app.route('/map_test/')
def test():
svg = render_template('file.svg')
response = make_response(svg)
response.content_type = 'image/svg+xml'
return render_template('test.html', svg=response)
和 test.html:
{% block content %}
<section>
{{ svg }}
</section>
{% endblock %}
...返回了<Response 126181 bytes [200 OK]>
而不是svg元素...
那么...我需要做什么才能让它正常工作呢?