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
  • 90,050
  • 14
  • 168
  • 180
Alejandro A
  • 1,080
  • 8
  • 23

1 Answers1

2

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
  • 341
  • 1
  • 3
  • 12