Lần đầu tiên học Flask và tôi đang cố gắng xây dựng mọi thứ theo hướng dẫn. Tôi nhận được thông báo này trong trình duyệt của mình khi tôi nhập url này:Lỗi máy chủ nội bộ Flask
http://127.0.0.1:5000/index
127.0.0.1 - - [16/Jun/2014 19:37:41] "GET /index HTTP/1.1" 500 -
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.
Tôi không chắc tại sao tôi gặp phải lỗi này. Ai đó có thể giúp tôi và nói cho tôi biết tại sao? Tôi mới vào bình và phát triển web
mã:
from flask import Flask, request, make_response, redirect, render_template
from flask.ext.script import Manager
from flask.ext.bootstrap import Bootstrap
app = Flask(__name__)
manager = Manager(app)
bootstrap = Bootstrap(app)
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/user/<name>')
def user(name):
return render_template('user.html', name = name)
if __name__ == '__main__':
#app.run(debug = True)
manager.run()
index.html:
{% extends "base.html" %}
{% block title %} Index {% block title %}
{% block head %}
<!-- Uses super() to retain the original contents-->
{{ super() }}
<style type="text/css">
</style>
{% endblock %}
{% block body %}
<h1>Hello, World!</h1>
{% endblock %}
Đây là cấu trúc dự án của tôi:
/Flask_0_11
/templates
base.html
index.html
user.html
hello.py