0

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

S0ulzz
  • 5
  • 5

1 Answers1

0

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.

AudioBaton
  • 361
  • 2
  • 6
  • Hello, I've tried that too. Seems that im still receiving a 404 error. I've added another picture to show how my folder looks like – S0ulzz Sep 04 '22 at 09:55
  • is this the only route behaving this way? – AudioBaton Sep 04 '22 at 18:20
  • No, all my routes seem to act this way. – S0ulzz Sep 06 '22 at 09:00
  • @s0ulzz it may be worth looking at the docs and starting from scratch to help find out where you went wrong. – AudioBaton Sep 06 '22 at 16:28
  • Just tested. I think there might be an issue with me not using a route?? I've tried to do it without a route so far, and im not certain how to work around that issue. I've added another picture for reference. – S0ulzz Sep 07 '22 at 06:40
  • oh, I think I misunderstood your original question. you are asking how to link between your routes/pages in HTML. I'll update my answer. – AudioBaton Sep 07 '22 at 14:45
  • Thank you so much, my friend! I can finally move to construct the other parts of my project. So sorry for not providing a clearer understanding of my question earlier! – S0ulzz Sep 08 '22 at 13:00