Separating html and JavaScript in Flask [duplicate]
You need to invoke the url_for function within a markup so that the correct url be resolved, i.e. Please consider following the Quick Start guide fully as it will help with other issues you might have.