Answer the question
In order to leave comments, you need to log in
How to call python command in html using jinja2?
I want to call trans command in
app.py html file:
def trans(txt): # функция для вызова
return txt
{{ trans('test') }} // Вызываю функцию, но нечего не происходит
Answer the question
In order to leave comments, you need to log in
well, let me read the docks for you https://flask.palletsprojects.com/en/2.0.x/templat...
Well, at least for starters, pass it to the context:
def foo():
return "foo() called"
Template("{{ foo() }}").render(foo=foo)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question