python - Issue importing object within the same directory -
let's assume have directory structure:
tumblelog/ __init__.py manage.py when try import app __init__.py in manage.py statement:
from tumblelog import app i following error:
importerror: no module named tumblelog
you have import module not directory.
your code has be:
from __init__ import app this create pyc file. "from" expression declares file, "import" declares function being imported.
alternatively, if want import functions write
import __init__ and write
__init__.app() to use it
or import without having retype module time:
from __init__ import *
Comments
Post a Comment