[Tutor] if request.method == 'GET': NameError: global name 'request' is not defined

Cameron Simpson cs at zip.com.au
Mon Jan 18 04:55:45 EST 2016


On 17Jan2016 20:13, sudipto manna <sudiptod19 at gmail.com> wrote:
>Here is the code snippet:
>
>File#FlaskTest2.py
>
>from flask import Flask

You need to import "request" from flask as well:

  from flask import Flask, request

For others on this list: the Flask framework presents the current web request 
as a thread local global called "request"; simplifies writing handlers as the 
request information is readily available without having to pass it through 
function calls.

Cheers,
Cameron Simpson <cs at zip.com.au>


More information about the Tutor mailing list