Recently I bought a droplet in digital ocean to put my project live.It works just fine in my local computer and doesn't have any problem with the directory structure.However once I put this on a server, Python throws an error.Below is my project structure in my local computer.
Now when I move it to a server, this is my project structure
Now If I run a test file just to test the imports
cd integretation
ls
__init__.py __pycache__ request_constructor.py test.py
test.py
from format_data.output_filter import output_filter
print("Yes")
Now I run the file
python3 test.py
I get an error
Traceback (most recent call last):
File "test.py", line 1, in <module>
from format_data.output_filter import output_filter
ImportError: No module named 'format_data'
Why is that happening though the same import structure works in my local computer? I even tried to change the import to something like this
from service_rest.format_data.output_filter import output_filter
But this doesn't help either.What is going wrong?
Note: I have removed the topmost level directory ServiceHandler when transferring the files to the server.But adding it back doesn't help either.