Flask application on uwsgi gives a TypeError: 'Flask' object is not iterable

Viewed 4845

I'm running Python/Flask application on Python 3.5 in a virtualenv on Arch Linux. The application is run by a uwsgi server that is connected via socket to Nginx.

When I perform a request, I get the following uwsgi error:

Mar 23 02:38:19 saltminion1.local uwsgi[20720]: TypeError: 'Flask' object is not iterable

This is the callable that uwsgi is configured to use:

def create_app(config=None, import_name=None):
    if import_name is None:
        import_name = DefaultConfig.PROJECT

    app = Flask(import_name, instance_path=INSTANCE_FOLDER_PATH, instance_relative_config=True)

    configure_app(app, config)
    configure_database(app)
    configure_logging(app)
    configure_error_handlers(app)
    configure_blueprints(app)

    return app

Things work fine when I start the application using the built-in HTTP server both on the local OS X development workstation and on Arch/Ubuntu vagrant boxes.

Problem is: After adding debug statements it became clear the error occurs at some point in the Flask code itself and not within my app. How can I get a stack trace here to troubleshoot better?

2 Answers
Related