cjwates

TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.

flask Icon

TypeError

The view function did not return a valid response. The function either returned None or ended without a return statement.

An unhandled exception occurred on line 2098
2095
        # the body must not be None
2096
        if rv is None:
2097
            raise TypeError(
2098
                "The view function did not return a valid response. The"
2099
                " function either returned None or ended without a return"
2100
                " statement."

Solution

'return' was required to be added before calling the function!

def index():
    return qg.get_random_quote()            
Mar 26, 2021 Anyone

0 replies


Install the browser extension

Found this solution helpful? Try our extension for quick solutions to your Flask errors.

Chrome logo Add to Chrome - It's free