Directory Structure:
your_project/ - app.py - templates/ - index.html - other_page.html
Code in app.py:
from flask import Flask, render_template app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/other') def other_page(): return render_template('other_page.html') if __name__ == '__main__': app.run(debug=True)
Code in index.html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Index Page</title> </head> <body> <h1>Welcome to the Index Page</h1> <p>This is the main page.</p> <a href="/other">Go to Other Page</a> </body> </html>
Try to answer about this code:
Which route in the Flask application will render the index.html page?
/home
/
/about
/index
What does the anchor tag Go to Other Page do in the index.html file?
Redirects to the Flask admin panel
Navigates to the /other route within the Flask application
Opens an external website
Downloads a file named "Other Page"
What happens if the route /other is not defined in the Flask application?
Displays a 404 error page
Results in a "Not Found" error when navigating to /other
Redirects to the homepage automatically
Displays a blank page without any content
Which HTML tag defines the title of the web page in the provided code?
<meta>
<title>
<h1>
<header>