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

Issue

enter image description here[

    @app.route("/search")
    def search():
        return render_template("/search.html")
][1]

How my search route appears

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

{href="./search.html"}

but there is no difference.

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

Solution

EDIT

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