How to use Flask’s render_template() standalone without Flask app

Solution
>>> from flask import Flask, render_template_string
>>> app = Flask(__name__)
>>> with app.app_context():
>>>     render_template_string('I love {{fruit}}', fruit='apple')
'I love apple'