Dash app does not load assets and app.index_string

It has nothing to do with linux, it’s how you run your application that make the difference. We use flask.helpers.get_root_path which take a module name to resolves the path to the module. By default, we have __main__ as the module name for a fallback that will work when the app is called by it’s module name (eg: python app.py).

When you run it thru some other command line (like the flask command or gunicorn/waitress) the __main__ module is no longer located where app.py is and now refer to some place like /venv/lib/site-packages/flask. Giving __name__ explicitly will always give the right path to the assets folder.

5 Likes