flaskuwsgiwebassetsflask-assets

Flask Assets bundles not compiling when run under uWSGI


They run normally when I run the flask app directly but don't compile or replace the address in the template when run under uWSGI.

How can I debug this?

EDIT:

code: assets = Environment(app)

...

if __name__ == "__main__":        
    assets.register(YAMLLoader(os.path.join(DIR,"assets.yml")).load_bundles())

    if os.environ.get("DEBUG_FLASK"):
        app.run()
    else:
        app.run(debug=True)

assets.yml:

style_css:
    filters: less
    output: css/style.css
    contents:
        - css/style.less

Solution

  • Turns out uwsgi does its own thing with app variable to run the webapp and doesn't run the script as __main__ so

    assets.register(YAMLLoader(os.path.join(DIR,"assets.yml")).load_bundles())
    

    never got called. I moved it out of the

    if __name__ == "__main__":        
    

    block. And it worked.