I just installed flask-bootstrap and run it in my localhost. But I always getting Internal Server Error message when visiting "/dinner/" route. How to fix this error? Thanks
Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Main.py
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
app = Flask(__name__)
bootstrap = Bootstrap(app)
@app.route('/dinner/')
@app.route('/dinner/<food>')
def index(food):
return render_template('food.html', food=food, list=['sushi','pizza','hamburger'])
@app.errorhandler(404)
def page_not_found(error):
return render_template('page_not_found.html'), 404
food.html
{% extends "bootstrap/base.html" %}
{% block title %} What is for dinner? {% endblock %}
{% block content %}
<div class="container">
{% if food %}
<div class="alert alert-success">
<h1>I want that {{food}}</h1>
{% else %}
<div class="alert alert-info">
<h1>Anything is fine!</h1>
{% endif %}
</div>
{% if list %}
<ul>
{% for n in list %}
<li><a href="/dinner/{{n}}">{{n}}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endblock %}