Apache2.2 wsgi:无法导入python模块

时间:2015-12-18 17:33:54

标签: python django apache mod-wsgi

apache2错误日志:

[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1] mod_wsgi (pid=32472): Exception occurred processing WSGI script '/opt/pkgs/myprogram/extras/myprogram.wsgi'.
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1] Traceback (most recent call last):
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]   File "/opt/pkgs/myprogram-deps/lib/python2.7/site-packages/Django-1.7-py2.7.egg/django/core/handlers/wsgi.py", line 187, in __call__
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]     response = self.get_response(request)
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]   File "/opt/pkgs/myprogram-deps/lib/python2.7/site-packages/Django-1.7-py2.7.egg/django/core/handlers/base.py", line 199, in get_response
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]   File "/opt/pkgs/myprogram-deps/lib/python2.7/site-packages/Django-1.7-py2.7.egg/django/core/handlers/base.py", line 239, in handle_uncaught_exception
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]     if resolver.urlconf_module is None:
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]   File "/opt/pkgs/myprogram-deps/lib/python2.7/site-packages/Django-1.7-py2.7.egg/django/core/urlresolvers.py", line 361, in urlconf_module
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]     self._urlconf_module = import_module(self.urlconf_name)
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]     __import__(name)
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]   File "/opt/pkgs/myprogram/lib/python2.7/site-packages/myprogram-2.3.10-py2.7.egg/myprogect/urls.py", line 3, in <module>
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]     from views import index, login, logout
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]   File "/opt/pkgs/myprogram/lib/python2.7/site-packages/myprogram-2.3.10-py2.7.egg/myprogram/views.py", line 2, in <module>
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]     import dashboard.views
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]   File "/opt/pkgs/myprogram/lib/python2.7/site-packages/myprogram-2.3.10-py2.7.egg/dashboard/views.py", line 5, in <module>
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]     from lib.pdfgenerator import PDFGenerator
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]   File "/opt/pkgs/myprogram/lib/python2.7/site-packages/myprogram-2.3.10-py2.7.egg/lib/pdfgenerator.py", line 1, in <module>
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1]     from reportlab.lib.pagesizes import letter
[Fri Dec 18 17:25:14 2015] [error] [client 10.32.64.1] ImportError: No module named reportlab.lib.pagesizes

我的apache2conf的一部分:

WSGIPythonEggs /opt/data/myproject/tmp
WSGIPythonHome /usr
WSGIPythonPath /opt/pkgs/myproject-deps/lib/python2.7/site-packages:/opt/pkgs/myproject-portal/lib/python2.7/site-packages

我猜apache2找不到合适的python模块。但我不知道如何在apache2.conf中进行设置。最重要的是,不知道如何调试?

欢迎任何帮助。感谢。

0 个答案:

没有答案