Closed itinneed2022 closed 2 years ago
Sorry to bump an old issue, maybe you already found a workaround, but generally whenever you see ImportError: No module named X
, it means there's a problem with the python module search path.
To debug errors like this on any python application you can print the paths python is looking through:
import sys
print(sys.path)
Your error means that none of these directories contains the django module. To be more specific, it did not find a django/conf
directory in any of these paths since you were importing from "django.conf
". If you put a venv at /opt/graphite, like the docs recommend for graphite, then django should be in a directory like /opt/graphite/lib/python3.6/site-packages
.
It's a hard-coded solution, but I put this at the top of my graphite.wsgi file:
import sys
sys.path = ['', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/opt/graphite/lib64/python3.6/site-packages', '/opt/graphite/lib/python3.6/site-packages', '/opt/graphite/webapp']
The unix command find /opt/graphite -name django -type d
could help you verify the directory path.
edit: typo
Thanks, @jguzman-tech, I always struggled with compile small manual how to fix that issue (partially because it's rather quite generic and not graphite-specific).
The issue in this case was that the django modules at /usr/local/lib/python3.6/site-packages had very restricted permissions. Adding the +x option to them fixed it.
That makes sense, too bad python's error messages didn't clearly indicate a permissions problem. This issue can probably be closed.
My first comment here would apply more to a ModuleNotFoundError
in python.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
OS: Centos 7 Deployment: VirtualEnv using the Source installation Python Version: 3.6 Requirements file:
After manually moving a bunch of files around (its a mess) I finally got past the DB problem but I'm stuck with SQLlite 3.7.3 for some reason. Moving past that, this is the error I'm seeing in /opt/graphite/storage/log/webapp/errors.log:
my wsgi file:
Finally my vhost file:
Where have I gone wrong?