I am trying to render xhtml (X3D) files. The Problem is that when rendering those through a flask route one xhtml template would work correctly and another one not. Both files work perfectly fine when I open them in my browser manually. The secound file is a modification of the first one using BeautifulSoup.
#flask app module from flask import Flask, render_template app = Flask(__name__) @app.route("/") def hello_world(): return render_template('index.html') @app.route('/xhtml') def xhtml(): return render_template('8b0e87efd5144053916a1cadfc9c5194.xhtml') @app.route('/xhtml_2') def xhtml_2(): return render_template('920e053d8e474fc1869e9a2c763e9186.xhtml') if __name__ == '__main__': app.run(debug=True)
Is there something that I am missing about render_template()?
Working file: https://pastebin.com/qQi96Fcq
NOT working file: https://pastebin.com/HJiD9WTZ
Both files are very similar, because the secound file is just a modification of the first file using BeatifulSoup. I played around with the files and changed codeblocks step by step. I figured out, that BeautifulSoup changed
<Viewpoint ... ></Viewpoint>
<Viewpoint ... />
and jinja does not seem to like it. After changing those tags in the broken file it now gets rendered correctly:
<Viewpoint ... > </Viewpoint>
Even though noone could solve that Problem for me, I am still thankful for your input, as it got me thinking about my Problem more focussed.
Answered By – Aleksander Sadowski