Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'tutorial': 0.03; 'subject:Python': 0.06; '__name__': 0.09; 'extends': 0.09; 'skip:% 20': 0.09; 'typed': 0.09; 'url:localhost': 0.09; 'url:blog': 0.10; 'python': 0.11; 'def': 0.12; '<div': 0.16; "'__main__':": 0.16; 'setuptools': 0.16; 'url:8000': 0.16; 'url:post': 0.16; 'app': 0.19; 'import': 0.22; 'error': 0.23; 'header': 0.24; 'post': 0.26; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'gives': 0.31; 'getting': 0.31; 'skip:& 30': 0.33; 'url:non- standard http port': 0.33; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'skip:- 20': 0.37; 'server': 0.38; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; '(from': 0.39; 'to:addr:python.org': 0.39; 'simple': 0.61; 'world': 0.66; '500': 0.70; 'why?': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=Nsgwu4MAVvQnvmmvanGYE7r+bpck9iU3J4Nh1SA9jHo=; b=bn2xccg/gBIsEI2zCVwByZZaRN6vsgx9lA8HKCGcyj8IBSLI0BVITdh1ZNvkLIZ57l Ci8KL1efK/fm1FjHyWYva/ydLr25X2cDLzewMxT1GSL++0UZ2vpPgdAkyW6uNkAaoaW6 5YtRy34bfHqouRgToEBgaVDSWbiwVH05q6gr903PZAxI8dSJxpCZLUh/yuGauBF83hR+ 5hHGy3OCppaezUY2uoZdbWeo81cS4KgNBnpat5sXUP+LvV1SSGJ96yTdgS8O3uoNtR9N 7s4EslHuoWtERQ3Xp0vd8Lxuk9cHDC3X8B536rn/IiZIwdH/vr1yE/N1CpSl9/wWLAHB U7HQ== X-Received: by 10.112.205.39 with SMTP id ld7mr2186268lbc.40.1411507974885; Tue, 23 Sep 2014 14:32:54 -0700 (PDT) MIME-Version: 1.0 From: Juan Christian Date: Tue, 23 Sep 2014 18:32:34 -0300 Subject: Flask and Python 3 To: Python Content-Type: multipart/alternative; boundary=001a11c3c41a70d88d0503c24f15 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 130 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411507982 news.xs4all.nl 2876 [2001:888:2000:d::a6]:34072 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78248 --001a11c3c41a70d88d0503c24f15 Content-Type: text/plain; charset=UTF-8 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: {% block head %} Test {% endlbock head %} {% block content %}{% endlbock content %} ------------------------ post.html: {% extends "base.html" %} {% block content %}
{{ post_content }}
{% 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) --001a11c3c41a70d88d0503c24f15 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I'm following a tutorial about Flask using Python 3.4.= 1, but I'm getting an error with a dead simple example:

<= div>generator.py:

from flask import Flask, re= nder_template


app =3D Flask(__name_= _)

@app.route('/')
def index():<= /div>
return 'He= llo World'


@app.route('/blo= g/post/')
def post():
return render_template('post.html', post_cont= ent =3D "Hello, World (from a template)")


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

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

= base.html:

<html>
<head>= ;
{% block hea= d %}
<titl= e>Test</title>
{% endlbock head %}
</head>
<body>= ;

{% block content %}{% endlbock content %}
<= div>
</body>
</html>
------------------------

post.html:

{% extends "base.html" %}
=
{% block content %}
<!-- Header -->
<div id =3D "header">
<h1>Blog post t= itle</h1>
<h2>Subtitle</h2>
<h3 id =3D "date">date</h3>
=
</div>
<= div>
<!= -- Contect -->
<div id =3D "content">
{{ post_content }}
</div>
{% endblock conte= nt %}

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

I typed everything correct,acessing=C2=A0http://localhost:8000 works, but=C2=A0http://localhost:8000/blog/post/ gives me &= #39; 500 Internal Server Error=C2=A0'. Why?

Py= thon 3.4.1

Flask (0.10.1)
itsdanger= ous (0.24)
Jinja2 (2.7.3)
MarkupSafe (0.23)
p= ip (1.5.6)
setuptools (5.8)
Werkzeug (0.9.6)

--001a11c3c41a70d88d0503c24f15--