I’m deploying my dash app to heroku and I’m getting the following
2021-05-08T16:05:43.425389+00:00 app[web.1]: ModuleNotFoundError: No module named 'config'
2021-05-08T16:05:43.425638+00:00 app[web.1]: [2021-05-08 16:05:43 +0000]  [INFO] Worker exiting (pid: 8)
2021-05-08T16:05:43.596511+00:00 app[web.1]: [2021-05-08 16:05:43 +0000]  [WARNING] Worker with pid 8 was terminated due to signal 15
2021-05-08T16:05:43.688607+00:00 app[web.1]: [2021-05-08 16:05:43 +0000]  [INFO] Shutting down: Master
2021-05-08T16:05:43.688739+00:00 app[web.1]: [2021-05-08 16:05:43 +0000]  [INFO] Reason: Worker failed to boot.
2021-05-08T16:05:43.752934+00:00 heroku[web.1]: Process exited with status 3
2021-05-08T16:05:43.887219+00:00 heroku[web.1]: State changed from up to crashed
I have a config.py file that has a Mapbox token and so I’ve included it in .gitignore but apparently heroku is also ignoring that file.
Any help would be really appreciated
You should use environment variables for this, so:
- this creates the env variable in your heroku application
heroku config:set MAPBOX_TOKEN="pk.fooooooooooooo"
- this loads the env variable in your code
- Remove the
config.py from your
You can also manage environment variables in heroku UI in your app settings
To make it short, it means that you lacked some “dependencies” for the libraries you wanted to use. This is a common problem when installing python packages, mainly in windows. Before trying to use any kind of library, first it is suggested to look up whether it needs another library in python “family”.
The solution is to provide the python interpreter with the path-to-your-module/library. The simplest solution is to append that python path to your sys.path list. In your notebook, first try:
This isn’t a permanent change in sys.path, because when you log out, your environment is reset, so any variables you may have set are lost.
The better (and more permanent) way to solve this is to set your PYTHONPATH, which provides the interpreter with additional directories look in for python packages/modules.
from BASH type: export PYTHONPATH=/path/to/new/folder:/another/path/...../
#each path must be separated by a colon