Category : jinja2

Lets say I have this defined in my group_vars: ucarp_data: – vhid: 6 interface: eth0 hosts: – 10.1.60.4 – 10.1.60.5 options: –shutdown –preempt – vhid: 9 interface: eth0 hosts: – 10.1.60.7 – 10.1.60.8 options: –shutdown –preempt I want to check that the host I’m currently running against is in this hosts: array. Something like: – ..

Read more

I think I’m missing something with Flask. I want to read my dictionary which is a static file to a basic template and make it appear with Flask. Any idea why I’m getting an error? Thanks! from flask import Flask, render_template app = Flask(__name__) @app.route(‘/’) def main(): return render_template(‘main.html, switch=switchList’) if __name__ == ‘__main__’: app.run(debug=True) ..

Read more

I want to define a variable page_title = ‘YouThoob’ in app.py in Flask and acces it in base.html using jinja-2 syntax without passing it as an argument in each render_template function. Like in app.py I have From flask import Flask, render_template app = Flask(__name__) page_title = ‘YouThoob’ @app.route(‘/’) def index(): return render_template("base.html") # I don’t ..

Read more

How to create complex pages in Flask? Details: Every Flask tutorial advertise how easy is to use Flask and templates but none actually go to create a complex (beyond basic) page. By complex page I mean: pages that show different sections, lists/tables extracted from DB, aggregate methods applied to data extracted from DB and so ..

Read more

I am complete begineer in flask and i am making an e commerce app. I am using python3.6. I get this error when i try to login. Please forgive my messy code def login(): if request.method == "POST": if ‘user’in session: flash(‘Already logged in’) return redirect(url_for(‘home’)) elif request.method == "POST": session.permanent = True username = ..

Read more

I installed on MacOS python, pip, upgraded it to pip3, then installed jinja2 and j2cli. How should I run j2cli? $ pip3 show jinja2 Name: Jinja2 Version: 2.11.2 Summary: A very fast and expressive template engine. Home-page: https://palletsprojects.com/p/jinja/ Author: Armin Ronacher Author-email: [email protected] License: BSD-3-Clause Location: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages Requires: MarkupSafe Required-by: j2cli $ pip3 show j2cli ..

Read more