[FIXED] Why does my flask route show 404, after trying to link it into my starting page


enter image description here[

    def search():
        return render_template("/search.html")

How my search route appears

This the code used in my app.py.
I have tried


but there is no difference.

How my project folder looks like
Edit 2:
My mistake in the routing



to link your routes from within your HTML pages, you can use the url_for function inside double curly brackets. so in your case it would be something like this:

<a href="{{url_for('search')}}">Search Page</a>

note that the value you pass into url_for is the name of the function for your route, not the route itself.

see this answer for more info.

Answered By – AudioBaton

Answer Checked By – David Marino (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published