Question 18
Consider the following Flask application structure and code.
my_project/├── app.py├── views/│ └── dashboard.html├── templates/│ ├── base.html│ └── home.html└── custom_templates/ ├── admin/ │ └── login.html └── user/ └── profile.htmlapp.py:
from flask import Flask, render_template
app = Flask(__name__, template_folder='custom_templates')
@app.route('/')def home(): return render_template('home.html')
@app.route('/admin')def admin_login(): return render_template('admin/login.html')
@app.route('/profile')def user_profile(): return render_template('user/profile.html')
@app.route('/dashboard')def dashboard(): return render_template('dashboard.html')
if __name__ == '__main__': app.run(debug=True)Which of the following statements about the template rendering behavior is correct?
All routes will work correctly as Flask will automatically search in both templates/ and custom_templates/ folders
The / and /dashboard routes will fail with TemplateNotFound error, while /admin and /profile routes will work correctly
Only the /admin and /profile routes will work correctly, while / and /dashboard routes will fail with TemplateNotFound error
All routes will fail because Flask requires the template folder to be named exactly templates