Attach the service locator to flask.g instead of flask.Flask.