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


Groups > comp.lang.python > #78248 > unrolled thread

Flask and Python 3

Started byJuan Christian <juan0christian@gmail.com>
First post2014-09-23 18:32 -0300
Last post2014-09-26 14:20 -0400
Articles 18 — 7 participants

Back to article view | Back to comp.lang.python


Contents

  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

#78248 — Flask and Python 3

FromJuan Christian <juan0christian@gmail.com>
Date2014-09-23 18:32 -0300
SubjectFlask and Python 3
Message-ID<mailman.14288.1411507982.18130.python-list@python.org>

[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)

[toc] | [next] | [standalone]


#78251

FromJohn Gordon <gordon@panix.com>
Date2014-09-23 21:48 +0000
Message-ID<lvsps8$64h$1@reader1.panix.com>
In reply to#78248
In <mailman.14288.1411507982.18130.python-list@python.org> Juan Christian <juan0christian@gmail.com> writes:

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

As posted, your code is not indented.  Is this literally how your code
looks?

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

"endlbock" is certainly a typo.

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

Have you looked in the http server error log for an explanatory error
message?

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gordon@panix.com    watch 'House', or a real serial killer to watch 'Dexter'.

[toc] | [prev] | [next] | [standalone]


#78252

FromJuan Christian <juan0christian@gmail.com>
Date2014-09-23 18:57 -0300
Message-ID<mailman.14289.1411509443.18130.python-list@python.org>
In reply to#78251

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

On Tue, Sep 23, 2014 at 6:48 PM, John Gordon <gordon@panix.com> wrote:
>
> > @app.route('/')
> > def index():
> > return 'Hello World'
>
> As posted, your code is not indented.  Is this literally how your code
> looks?
>
>
The mail screwed the indentation, it's indented in the file.


> > {% block content %}{% endlbock content %}
>
> "endlbock" is certainly a typo.


Oh my Gooooodd... Yes, that's it, working 100% now. Thanks!

[toc] | [prev] | [next] | [standalone]


#78260

FromTerry Reedy <tjreedy@udel.edu>
Date2014-09-23 19:46 -0400
Message-ID<mailman.14296.1411516042.18130.python-list@python.org>
In reply to#78251
On 9/23/2014 5:57 PM, Juan Christian wrote:
> On Tue, Sep 23, 2014 at 6:48 PM, John Gordon <gordon@panix.com
> <mailto:gordon@panix.com>> wrote:
>
>     > @app.route('/')
>     > def index():
>     > return 'Hello World'
>
>     As posted, your code is not indented.  Is this literally how your code
>     looks?
>
> The mail screwed the indentation, it's indented in the file.

Did you use tabs? They are more likely to disappear than spaces.


-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#78262

FromJon Ribbens <jon+usenet@unequivocal.co.uk>
Date2014-09-24 00:33 +0000
Message-ID<slrnm244b2.bc7.jon+usenet@frosty.unequivocal.co.uk>
In reply to#78248
On 2014-09-23, Juan Christian <juan0christian@gmail.com> wrote:
> if __name__ == '__main__':
>     app.run(port = 8000)

app.run(port=8000, debug=True) might've made the problem easier to find.

[toc] | [prev] | [next] | [standalone]


#78263

FromJuan Christian <juan0christian@gmail.com>
Date2014-09-23 22:23 -0300
Message-ID<mailman.14298.1411521814.18130.python-list@python.org>
In reply to#78262

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

On Tue, Sep 23, 2014 at 8:46 PM, Terry Reedy <tjreedy@udel.edu> wrote:
>
> Did you use tabs? They are more likely to disappear than spaces.


Yes, I use tabs.

On Tue, Sep 23, 2014 at 9:33 PM, Jon Ribbens <jon+usenet@unequivocal.co.uk>
wrote:
>
> app.run(port=8000, debug=True) might've made the problem easier to find.
>

I didn't learn debug with Flask yet. Only in the next videos.

[toc] | [prev] | [next] | [standalone]


#78288

FromChris “Kwpolska” Warrick <kwpolska@gmail.com>
Date2014-09-24 16:09 +0200
Message-ID<mailman.14314.1411567785.18130.python-list@python.org>
In reply to#78262
On Wed, Sep 24, 2014 at 3:23 AM, Juan Christian
<juan0christian@gmail.com> wrote:
> I didn't learn debug with Flask yet. Only in the next videos.

Learning from videos is the worst thing you can do.  Use the official
flask documentation at http://flask.pocoo.org/docs/0.10/quickstart/ —
it’s much friendlier than a video.

Also, there is nothing to “learn” — just change the line, and you will
have more helpful errors.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense

[toc] | [prev] | [next] | [standalone]


#78306

FromJuan Christian <juan0christian@gmail.com>
Date2014-09-24 16:39 -0300
Message-ID<mailman.14327.1411587600.18130.python-list@python.org>
In reply to#78262

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

On Wednesday, September 24, 2014, Chris “Kwpolska” Warrick <
kwpolska@gmail.com> wrote:

> Learning from videos is the worst thing you can do.  Use the official
> flask documentation at http://flask.pocoo.org/docs/0.10/quickstart/ —
> it’s much friendlier than a video.
>
> Also, there is nothing to “learn” — just change the line, and you will
> have more helpful errors.
>

That's the way I always learned everything. I watch some video courses,
read a book and read the official documentation altogether.

My way can't work for you, but for me it's excellent. And you don't even
know which video/course I'm talking about, so it's gross to tell that
"videos are the worst thing"...

Anyway, the problem was solved, I already learned lots of new things and
I'm practicing them.

[toc] | [prev] | [next] | [standalone]


#78321

FromChris Angelico <rosuav@gmail.com>
Date2014-09-25 11:46 +1000
Message-ID<mailman.14340.1411609577.18130.python-list@python.org>
In reply to#78262
On Thu, Sep 25, 2014 at 5:39 AM, Juan Christian
<juan0christian@gmail.com> wrote:
> That's the way I always learned everything. I watch some video courses, read
> a book and read the official documentation altogether.
>
> My way can't work for you, but for me it's excellent. And you don't even
> know which video/course I'm talking about, so it's gross to tell that
> "videos are the worst thing"...

It doesn't matter which video/course you were talking about. Chris was
talking about the *format* of videos. And I agree with him.

ChrisA

[toc] | [prev] | [next] | [standalone]


#78347

FromChris “Kwpolska” Warrick <kwpolska@gmail.com>
Date2014-09-25 19:28 +0200
Message-ID<mailman.14363.1411666114.18130.python-list@python.org>
In reply to#78262
On Wed, Sep 24, 2014 at 9:39 PM, Juan Christian
<juan0christian@gmail.com> wrote:
> On Wednesday, September 24, 2014, Chris “Kwpolska” Warrick
> <kwpolska@gmail.com> wrote:
>>
>> Learning from videos is the worst thing you can do.  Use the official
>> flask documentation at http://flask.pocoo.org/docs/0.10/quickstart/ —
>> it’s much friendlier than a video.
>>
>> Also, there is nothing to “learn” — just change the line, and you will
>> have more helpful errors.
>
>
> That's the way I always learned everything. I watch some video courses, read
> a book and read the official documentation altogether.
>
> My way can't work for you, but for me it's excellent. And you don't even
> know which video/course I'm talking about, so it's gross to tell that
> "videos are the worst thing"...

It doesn’t matter.  Here, have some wisdom, as provided by the top
Google hit for “video tutorials suck”:
https://news.ycombinator.com/item?id=4565615

The thing is, it’s text.  I suppose I could use some text-to-speech
software to provide you with a video tutorial version of that.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense

[toc] | [prev] | [next] | [standalone]


#78349

FromJuan Christian <juan0christian@gmail.com>
Date2014-09-25 15:18 -0300
Message-ID<mailman.14365.1411669130.18130.python-list@python.org>
In reply to#78262

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

On Thu, Sep 25, 2014 at 2:28 PM, Chris “Kwpolska” Warrick <
kwpolska@gmail.com> wrote:
>
> It doesn’t matter.  Here, have some wisdom, as provided by the top
> Google hit for “video tutorials suck”:
> https://news.ycombinator.com/item?id=4565615
>

Using your link, the first comment from user 'arocks':

" If you have been into teaching you would realize that there are different
kinds of learners. Some prefer verbal material, others prefer more visual,
while some others like written material. The vast majority however prefer a
combination of the above. While you can pour over tutorials on how to use
Emacs; just watching a video of a power user using Emacs gives you a
different impression. It is really a completely different experience.

Sometimes it is faster to produce a set of video tutorials than to prepare
well-written documentation. Hence they make a call. However, I agree that
written documentation is the best medium for long term (i.e. smaller,
searchable etc)

So, rather than asking for one medium of instruction to stop, I would
rather encourage the plurality. Let the end-user pick and choose whatever
he/she likes. "


As the guy said, and many others in the comments agree, "rather than asking
for one medium of instruction to stop, I would rather encourage the
plurality.", and indeed, I prefer plurality, I DO use the official doc, I
don't only see video-tutorials. You don't know me, you don't know my
learning process, so stop imposing what YOU think is right, because what's
right for YOU won't necessarily be for others. No matter what you say, it
won't change, don't try to standardize the learning process, you nor anyone
can do this.



> The thing is, it’s text.  I suppose I could use some text-to-speech
> software to provide you with a video tutorial version of that.


No, you can't, if you think a video tutorial is only that, I'm afraid to
tell that you only saw terrible courses/tutorials in your life.

[toc] | [prev] | [next] | [standalone]


#78350

FromChris Angelico <rosuav@gmail.com>
Date2014-09-26 04:23 +1000
Message-ID<mailman.14366.1411669386.18130.python-list@python.org>
In reply to#78262
On Fri, Sep 26, 2014 at 4:18 AM, Juan Christian
<juan0christian@gmail.com> wrote:
> On Thu, Sep 25, 2014 at 2:28 PM, Chris “Kwpolska” Warrick
> <kwpolska@gmail.com> wrote:
>>
>> It doesn’t matter.  Here, have some wisdom, as provided by the top
>> Google hit for “video tutorials suck”:
>> https://news.ycombinator.com/item?id=4565615
>
>
> Using your link, the first comment from user 'arocks':
>
> " So, rather than asking for one medium of instruction to stop, I would rather
> encourage the plurality. Let the end-user pick and choose whatever he/she
> likes. "
>
>
> As the guy said, and many others in the comments agree, "rather than asking
> for one medium of instruction to stop, I would rather encourage the
> plurality.", and indeed, I prefer plurality, I DO use the official doc, I
> don't only see video-tutorials. You don't know me, you don't know my
> learning process, so stop imposing what YOU think is right, because what's
> right for YOU won't necessarily be for others. No matter what you say, it
> won't change, don't try to standardize the learning process, you nor anyone
> can do this.

Actually, what most of the comments are agreeing on is that videos
need their transcripts. Without them, they suck. Most videos don't
have any sort of transcript. Ergo, most videos suck.

ChrisA

[toc] | [prev] | [next] | [standalone]


#78351

FromChris “Kwpolska” Warrick <kwpolska@gmail.com>
Date2014-09-25 20:26 +0200
Message-ID<mailman.14367.1411669583.18130.python-list@python.org>
In reply to#78262
On Thu, Sep 25, 2014 at 8:18 PM, Juan Christian
<juan0christian@gmail.com> wrote:
>> The thing is, it’s text.  I suppose I could use some text-to-speech
>> software to provide you with a video tutorial version of that.
>
>
> No, you can't, if you think a video tutorial is only that, I'm afraid to
> tell that you only saw terrible courses/tutorials in your life.

Go on, show me a good video tutorial.  One that is quick to consume,
and one I can come back to at any time I please (within reasonable
bounds).  I can just open a text-based tutorial and use my browser’s
search capabilities (or a Table of Contents or an index in an analog
book) to find the precise bit of knowledge I need.  You can’t easily
do that with video tutorials.

Also, video tutorials for code (as well as analog books) lack a very
important feature: copy-paste.  Nobody likes retyping large passages
of code.  Especially because it’s error-prone.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense

[toc] | [prev] | [next] | [standalone]


#78352

FromJuan Christian <juan0christian@gmail.com>
Date2014-09-25 15:35 -0300
Message-ID<mailman.14368.1411670159.18130.python-list@python.org>
In reply to#78262

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

On Thu, Sep 25, 2014 at 3:23 PM, Chris Angelico <rosuav@gmail.com> wrote:

> Actually, what most of the comments are agreeing on is that videos
> need their transcripts. Without them, they suck. Most videos don't
> have any sort of transcript. Ergo, most videos suck.


I'm not talking about "360p 3min kid's tutorial form Youtube" here, when I
say video tutorial, it's implied that every video that I talked about have
1. The source-code (if programming/code related), 2. The transcripts and in
some cases even 3. PDF version of the video. In this topic my code went
wrong because I did it on my own, and not crtlc/crtlv from the original
source-code, and it was a stupid typo error


On Thu, Sep 25, 2014 at 3:26 PM, Chris “Kwpolska” Warrick <
kwpolska@gmail.com> wrote:

> Also, video tutorials for code (as well as analog books) lack a very
> important feature: copy-paste.  Nobody likes retyping large passages
> of code.  Especially because it’s error-prone.


Coursera, edX, digitaltutors, tv.adobe, tutsplus and many other sites. But,
doesn't matter, if the person watching them is close minding and blindly
hate any type of video tutorial, all these sites, no matter how good they
are will suck for this person...


Any, I think you two fled the point here. I didn't create this topic in
order to talk about "video vs text", if you guy want to continue this waste
of time, create a topic and talk everything you want. I'm done here, as I
said, PLURALITY is the key thing, don't try to impose what you think is
right and wrong.

Bye.

[toc] | [prev] | [next] | [standalone]


#78353

FromChris Angelico <rosuav@gmail.com>
Date2014-09-26 03:46 +1000
Message-ID<mailman.14369.1411674212.18130.python-list@python.org>
In reply to#78262
On Fri, Sep 26, 2014 at 3:28 AM, Chris “Kwpolska” Warrick
<kwpolska@gmail.com> wrote:
> It doesn’t matter.  Here, have some wisdom, as provided by the top
> Google hit for “video tutorials suck”:
> https://news.ycombinator.com/item?id=4565615

"""The online video medium may be great for bloggers, but when I'm
seeking information, everything else is a distraction."""

Not sure what "bloggers" means here. I blog in plain text, because I
believe it's the best medium for anything of importance. If you're
going to write something and then stand by it, and expect people to
respond with serious debate, text is by far the best way to convey
your point, if for one reason: quotability. Go ahead, make a video
response, and quote something someone else said! Easy, isn't it? No?
Hmm. Would you prefer to try quoting something from a text blog?

http://rosuav.blogspot.com/

Maybe you're offended by my stance on the Bible. Or maybe you think
Alice's Adventures In Down-Under-Land are worth talking about. Or
perhaps you think my review of The Merry Widow is unfair to your
sister's cousin's aunt who was in the cast. You can grab some of my
text, surround it with quote characters, copy and paste the link to my
blog, and make your own point. In five seconds, if you're used to it.
Even if you're really familiar with your tools, I doubt very much that
you can quote a video that quickly.

ChrisA

[toc] | [prev] | [next] | [standalone]


#78355

FromChris Angelico <rosuav@gmail.com>
Date2014-09-26 09:55 +1000
Message-ID<mailman.14370.1411689354.18130.python-list@python.org>
In reply to#78262
On Fri, Sep 26, 2014 at 4:35 AM, Juan Christian
<juan0christian@gmail.com> wrote:
> when I say video tutorial, it's implied that every video that I talked about
> have 1. The source-code (if programming/code related), 2. The transcripts
> and in some cases even 3. PDF version of the video.

I've almost never seen videos that have all of that - and certainly
not enough to *imply* that about the term.

ChrisA

[toc] | [prev] | [next] | [standalone]


#78376

FromNed Batchelder <ned@nedbatchelder.com>
Date2014-09-26 07:41 -0400
Message-ID<mailman.14392.1411731710.18130.python-list@python.org>
In reply to#78262
On 9/25/14 2:26 PM, Chris “Kwpolska” Warrick wrote:
> On Thu, Sep 25, 2014 at 8:18 PM, Juan Christian
> <juan0christian@gmail.com> wrote:
>>> The thing is, it’s text.  I suppose I could use some text-to-speech
>>> software to provide you with a video tutorial version of that.
>>
>>
>> No, you can't, if you think a video tutorial is only that, I'm afraid to
>> tell that you only saw terrible courses/tutorials in your life.
>
> Go on, show me a good video tutorial.  One that is quick to consume,
> and one I can come back to at any time I please (within reasonable
> bounds).  I can just open a text-based tutorial and use my browser’s
> search capabilities (or a Table of Contents or an index in an analog
> book) to find the precise bit of knowledge I need.  You can’t easily
> do that with video tutorials.
>
> Also, video tutorials for code (as well as analog books) lack a very
> important feature: copy-paste.  Nobody likes retyping large passages
> of code.  Especially because it’s error-prone.
>

Chris, you are trying to convince the OP that videos are a bad way to 
learn, after the OP has told you that it is his part of his preferred 
way to learn.  Seriously? Do you really think you know what is best for 
everyone?  Different people learn in different ways, and there could be 
a large generational component at work here.

It's clear that you prefer text content to video content.  I do too. 
Lots of people do.  But videos are popular also.

Can't we just stick to trying to help people with Python, and let them 
make other decisions for themselves?

-- 
Ned Batchelder, http://nedbatchelder.com

[toc] | [prev] | [next] | [standalone]


#78387

FromTerry Reedy <tjreedy@udel.edu>
Date2014-09-26 14:20 -0400
Message-ID<mailman.14402.1411755692.18130.python-list@python.org>
In reply to#78262
On 9/26/2014 7:41 AM, Ned Batchelder wrote:

> Can't we just stick to trying to help people with Python, and let them
> make other decisions for themselves?

I agree. The OP should watch the video on debugging, and the off-topic 
discussion of video versus text should end.

-- 
Terry Jan Reedy

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web