-2

im new to flask and boostrap,im trying to make a button that link to another html

Project layout

-Norman
  -args
    -static
      -css
        -bootstrap.min.css
        -style.css
      -img
        -wall.jpg
    -templates
      -index.html
      -form.html
    -__init__.py
    -routes.py
 -.flaskenv 
 -readme.txt   
 -book.py

route.py:

from args import app # init.py
from flask import render_template
@app.route('/')
def index():
return render_template('index.html')
@app.route('/form')
def form():
return render_template('form.html')

__init__.py:

from flask import Flask
from flask_bootstrap import Bootstrap

app = Flask(__name__)
Bootstrap(app)

from args import routes

here is the code from index.html:

<div>
    <button class="submit-btn">Check availability</button>
    <a href="/form.html" class="btn btn-primary pull-right" role="button">check form</a>
</div>

im trying to link the button to open form.html with href but it says the requested url was not found on the server. opening localhost:5000 worked but the second route doesnt working

0

1 Answer 1

0

In your index.html: Replace /form.html to /form as you have registered the handle /form which when triggered, would render form.html

<div>
    <button class="submit-btn">Check availability</button>
    <a href="/form" class="btn btn-primary pull-right" role="button">check form</a>
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

i tried that but still doesnt work, anyway i just solve the problem by renaming form. not sure what happen

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.