1

I have a simple flask app:

def create_app():
    config_name = 'testing_local'

    app = Flask(__name__)
    app.config.from_object(CONFIG_BY_NAME[config_name])
    app.url_map.converters['bool'] = BooleanConverter
    @app.before_request
    def incoming_request_logging():
        print(request)
    return app

I get the error:

Undefined variable 'request'

I thought the wrapper included the request object when called?

In this example, first approved answer seems like the request object is inherited? Can anyone link me to a full example? How can I retrieve this variable?

Vinay Sajip
  • 95,872
  • 14
  • 179
  • 191
Alejandro A
  • 1,150
  • 1
  • 9
  • 28

1 Answers1

3

I guess declaring this at top of your program might solve your issue, if I think what you said it is:

from flask import request
dewDevil
  • 381
  • 1
  • 3
  • 12