Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78248

Flask and Python 3

From Juan Christian <juan0christian@gmail.com>
Date 2014-09-23 18:32 -0300
Subject Flask and Python 3
Newsgroups comp.lang.python
Message-ID <mailman.14288.1411507982.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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)

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Flask and Python 3 Juan Christian <juan0christian@gmail.com> - 2014-09-23 18:32 -0300
  Re: Flask and Python 3 John Gordon <gordon@panix.com> - 2014-09-23 21:48 +0000
    Re: Flask and Python 3 Juan Christian <juan0christian@gmail.com> - 2014-09-23 18:57 -0300
    Re: Flask and Python 3 Terry Reedy <tjreedy@udel.edu> - 2014-09-23 19:46 -0400
  Re: Flask and Python 3 Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2014-09-24 00:33 +0000
    Re: Flask and Python 3 Juan Christian <juan0christian@gmail.com> - 2014-09-23 22:23 -0300
    Re: Flask and Python 3 Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-09-24 16:09 +0200
    Re: Flask and Python 3 Juan Christian <juan0christian@gmail.com> - 2014-09-24 16:39 -0300
    Re: Flask and Python 3 Chris Angelico <rosuav@gmail.com> - 2014-09-25 11:46 +1000
    Re: Flask and Python 3 Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-09-25 19:28 +0200
    Re: Flask and Python 3 Juan Christian <juan0christian@gmail.com> - 2014-09-25 15:18 -0300
    Re: Flask and Python 3 Chris Angelico <rosuav@gmail.com> - 2014-09-26 04:23 +1000
    Re: Flask and Python 3 Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-09-25 20:26 +0200
    Re: Flask and Python 3 Juan Christian <juan0christian@gmail.com> - 2014-09-25 15:35 -0300
    Re: Flask and Python 3 Chris Angelico <rosuav@gmail.com> - 2014-09-26 03:46 +1000
    Re: Flask and Python 3 Chris Angelico <rosuav@gmail.com> - 2014-09-26 09:55 +1000
    Re: Flask and Python 3 Ned Batchelder <ned@nedbatchelder.com> - 2014-09-26 07:41 -0400
    Re: Flask and Python 3 Terry Reedy <tjreedy@udel.edu> - 2014-09-26 14:20 -0400

csiph-web