import of modules
while starting the flask app, the following error occurs:
| * Serving Flask app "o3webapp_be.backend.back_end.py"
backend_1 | * Environment: production
backend_1 | WARNING: This is a development server. Do not use it in a production deployment.
backend_1 | Use a production WSGI server instead.
backend_1 | * Debug mode: off
backend_1 | Usage: flask run [OPTIONS]
backend_1 |
backend_1 | Error: While importing "o3webapp_be.backend.back_end", an ImportError was raised:
backend_1 |
backend_1 | Traceback (most recent call last):
backend_1 | File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 240, in locate_app
backend_1 | __import__(module_name)
backend_1 | File "/srv/o3webapp-be/o3webapp_be/backend/back_end.py", line 2, in <module>
backend_1 | from userManager import UserManager
backend_1 | ModuleNotFoundError: No module named 'userManager'
it seems to happen due to the way you import your own modules, e.g. back_end.py:
from userManager import UserManager
while it should be either the full path like
from o3webapp_be.backend.userManager import UserManager
or a "local"-way ("." in front of userManager):
from .userManager import UserManager