Dash app deployment failed

Hello All!,

I tried to deploy multi pages app to render but failed to deploy.
Installation of packages works but deployment failed when come to access data.
Here is log from render:

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
==> Uploading build...
==> Build uploaded in 10s
==> Build successful 🎉
==> Deploying...
==> Running 'gunicorn --chdir src app:server'
Traceback (most recent call last):
  File "/opt/render/project/src/.venv/bin/gunicorn", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 66, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]", prog=prog).run()
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/base.py", line 235, in run
    super().run()
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/base.py", line 71, in run
    Arbiter(self).run()
    ^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/arbiter.py", line 57, in __init__
    self.setup(app)
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/arbiter.py", line 117, in setup
    self.app.wsgi()
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/base.py", line 66, in wsgi
    self.callable = self.load()
                    ^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 57, in load
    return self.load_wsgiapp()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp
    return util.import_app(self.app_uri)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/util.py", line 370, in import_app
    mod = importlib.import_module(module)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/python/Python-3.12.7/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/render/project/src/src/app.py", line 60, in <module>
    l_years, l_words, l_df, df_iso = load_dfs(path)
                                     ^^^^^^^^^^^^^^
  File "/opt/render/project/src/src/app.py", line 28, in load_dfs
    list_files = [file for file in os.listdir(path) if file.endswith('.csv')]
                                   ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'https://github.com/DSAGRO3F/microparticle_pollution_fossil_fuel/tree/main/data/GBD2019'
==> Exited with status 1
==> Common ways to troubleshoot your deploy: https://render.com/docs/troubleshooting-deploys
==> Running 'gunicorn --chdir src app:server'
Traceback (most recent call last):
  File "/opt/render/project/src/.venv/bin/gunicorn", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 66, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]", prog=prog).run()
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/base.py", line 235, in run
    super().run()
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/base.py", line 71, in run
    Arbiter(self).run()
    ^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/arbiter.py", line 57, in __init__
    self.setup(app)
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/arbiter.py", line 117, in setup
    self.app.wsgi()
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/base.py", line 66, in wsgi
    self.callable = self.load()
                    ^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 57, in load
    return self.load_wsgiapp()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp
    return util.import_app(self.app_uri)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.12/site-packages/gunicorn/util.py", line 370, in import_app
    mod = importlib.import_module(module)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/python/Python-3.12.7/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/render/project/src/src/app.py", line 60, in <module>
    l_years, l_words, l_df, df_iso = load_dfs(path)
                                     ^^^^^^^^^^^^^^
  File "/opt/render/project/src/src/app.py", line 28, in load_dfs
    list_files = [file for file in os.listdir(path) if file.endswith('.csv')]
                                   ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'https://github.com/DSAGRO3F/microparticle_pollution_fossil_fuel/tree/main/data/GBD2019'

From error msg, seems data file path is not correct. I have to say I tried “data/GBD2019” and “microparticle_pollution_fossil_fuel/tree/main/data/GBD2019”. But failed as well.

Here is screen shot of project structure on Github.

Finally I don’t know how to handle this issue,

Would you have any idea on how to solve this ?

Many thanks for your help !!

Hello,

from what I understand, you try to give a full URL (https://github.com/DSAGRO3F/microparticle_pollution_fossil_fuel/tree/main/data/GBD2019) to the os.listdir() function.
But this function accepts only local paths (absolute paths or relative paths).

From the logs, your Procfile seem to mention gunicorn --chdir src app:server .
So, the app will be executed from the srcdirectory.
Then if you need to access data folder , that is in the root folder like src , you’ll need to go up again.

Providing ../data/GBD2019 should work.

Hope it helps,

Many thanks for reply
Yes this is error I made !