Manipulate files using Flask templating

    0

    0

    RF-Fahad-Islam

    The code creates a response object and sets the response's data and mimetype properties. It then returns the response.

    Library: flask

    from flask import render_template, Response
    from project import app
    
    with app.app_context():
        data = render_template('rss.xml', posts=posts)
        response = Response(
          data,
          mimetype='application/xml', #File type
        )
        return response
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.