Flask and Python 3

Juan Christian juan0christian at gmail.com
Tue Sep 23 23:32:34 CEST 2014


I'm following a tutorial about Flask using Python 3.4.1, but I'm getting an
error with a dead simple example:

generator.py:

from flask import Flask, render_template


app = Flask(__name__)

@app.route('/')
def index():
return 'Hello World'


@app.route('/blog/post/')
def post():
return render_template('post.html', post_content = "Hello, World (from a
template)")


if __name__ == '__main__':
app.run(port = 8000)

------------------------

base.html:

<html>
<head>
{% block head %}
<title>Test</title>
{% endlbock head %}
</head>
<body>

{% block content %}{% endlbock content %}

</body>
</html>

------------------------

post.html:

{% extends "base.html" %}

{% block content %}
<!-- Header -->
<div id = "header">
<h1>Blog post title</h1>
<h2>Subtitle</h2>
<h3 id = "date">date</h3>
</div>

<!-- Contect -->
<div id = "content">
{{ post_content }}
</div>
{% endblock content %}

------------------------

I typed everything correct,acessing http://localhost:8000 works, but
http://localhost:8000/blog/post/ gives me ' 500 Internal Server Error '.
Why?

Python 3.4.1

Flask (0.10.1)
itsdangerous (0.24)
Jinja2 (2.7.3)
MarkupSafe (0.23)
pip (1.5.6)
setuptools (5.8)
Werkzeug (0.9.6)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140923/4fb2ee36/attachment.html>


More information about the Python-list mailing list