import os
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates'))
from flask import Flask,url_for
app = Flask(__name__)
@app.route('/')
def hello_world():
tmpl = env.get_template('index.html')
sidebar = env.get_template('sidebar.html')
return tmpl.render(root_url="",sidebar=sidebar.render())
if __name__ == '__main__':
app.run(debug=True)
and in tempaltes/index.html
{{ url_for('static', filename='js/main.js') }}
Though, I get url_for is not defined? I am trying to follow the examples online but I don't know why I get this