Home > Software engineering >  How to pass variable in url_for flask?
How to pass variable in url_for flask?

Time:09-14

in place of newyork I want to pass form.city.data which is a input from form by the user.

    <div>
        <iframe height="800" width="100%" 
            src="{{ url_for('static',filename='videos/newyork.html') }}" allowfullscreen></iframe>
    </div>

CodePudding user response:

u can try this way

{% set path = url_for('static',filename='videos/'   form.city.data   '.html') %}
<div>
    <iframe height="800" width="100%" 
        src="{{ path }}" allowfullscreen>
    </iframe>
</div>
  • Related