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


Groups > comp.lang.python > #78248

Flask and Python 3

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 <juan0christian@gmail.com>
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; '&lt;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 <juan0christian@gmail.com>
Date Tue, 23 Sep 2014 18:32:34 -0300
Subject Flask and Python 3
To Python <python-list@python.org>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14288.1411507982.18130.python-list@python.org> (permalink)
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

Show key headers only | 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