Answer the question
In order to leave comments, you need to log in
Can't see the file in the flask project, why?
It does not see the imported file, although the file itself is there, and the function also seems to be without errors, the import is registered in __init__.py
The code itself (github)
The error itself:
(env)
➜ flaskblog python runserver.py
Traceback (most recent call last):
File "runserver.py", line 1, in <module>
from flaskblog import app
File "/home/vagabund/web/flaskblog/flaskblog/__init__.py", line 4, in <module>
from helper import url_for_other_page
ImportError: No module named 'helper'
Answer the question
In order to leave comments, you need to log in
At one time there were similar problems - it is necessary to correctly understand the structure of the project and the assignment of "__init__" files.
For myself, I found a solution in studying ready-made templates for new projects, "skeletons" - this allowed me to better understand the importance of the correct organization of the project's file structure, which eliminated the errors described in the question.
I recommend looking at the following projects:
It won't be redundant.
Regarding the question, there is no error after deploying the project, I see this in the browser:
There were suspicions about the loading order of modules (and “dirty” __init__), which is why I suggested studying this issue in more detail.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question