Before start
I have been trying to accomplish it for some time now, but I had no luck. I’m trying to create my own python package, which I will import the modules in it, in separate files in my project. I tried to add my project’s directory to pythonpath via ‘sys’ but still the mod_wsgi do not recognize it:
import sys
sys.path.append('/var/www/')
from core.core import main
And when trying:
ImportError: No module named core.core
Any help would be appreciated
If you do not have the file
__init__.pyin your core folder, it will not be recognized as a package.Therefore the solution is to add a file
__init__.pyin your core folder.If you have already added the problem may be the absolute path … the core folder that has absolute path:
if the second option you have to do:
sys.path.append('/var/www/YourProject')