'Heroku add folder to PYTHONPATH

Hello) My project has the following structure:

app/
  - api/
  - ..some_folders/
  - web/
    start.py
    ...
    some files
    ...
- run.py
Procfile
requirements.txt

Paths in my python code are relative to the app folder, e.g. in the run.py I import from web import start.py. Therefore, I have the root and root/app (app as the source root). The entry point of the application is run.py. Locally, I am able to include source root to the PYTHONPATH using the pycharm run options and the program works as I need.

My question is: how can I mark my app folder on Heroku so that it understands that the application should start from the root folder (where run files are located), while imports should be made relative to the app root.

Would be glad for any help🙂



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source