3 ms·
Flask's routes return strings, there's nothing stopping you from doing this. The render_template function is just a convenience.
by okasaki 3y ago
Flask's routes return strings, there's nothing stopping you from doing this. The render_template function is just a convenience.
- uranusjr 3y agoTechnically the string return type is just a shorthand, IIRC render_template returns a Response object that sets Content-Type and other things appropriately. But yeah it’s pretty trivial to create an HTML formatting library and use it with Flask. (I think there’s already libraries for the tag syntax, you just need to hook it into Flask, or literally any Python web framework really.)