I know this question has been asked in a lot of places, but none of them really seem to answer my question.
I am creating a standalone application in python, my current project structure is like so:
Project/
utils/
log.py
api/
get_data_from_api.py
main.py
I would like to have a set up similar to django, in which I can refer to any file by using a Project.<package>
syntax.
For example, if I wanted to access my log
module from my get_data_from_api
module, I could do something like this:
get_data_from_api.py
import Project.utils.log
# Rest of code goes here...
However, I can't seem to get that to work, even when I added an __init__.py
file in the root directory.
I read somewhere that I should modify my PYTHONPATH
, but I would like to prevent that, if possible. Additionally, django seemed to pull it off, as I couldn't find any PYTHONPATH
modification code in there.
I really appreciate the help!
Post Note: Where would tests
fit in this file structure? I would like them to be separate, but also have access to the entire project really easily.