这是我正在获取的错误日志
[Mon Dec 29 20:29:38 2014] [warn] mod_wsgi: Compiled for Python/2.7.5.
[Mon Dec 29 20:29:38 2014] [warn] mod_wsgi: Runtime using Python/2.7.9.
[Mon Dec 29 20:29:38 2014] [notice] Apache/2.2.25 (Unix) mod_wsgi/3.4 Python/2.7.9 configured -- resuming normal operations
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] mod_wsgi (pid=17333): Exception occurred processing WSGI script '/home/rock/webapps/hswcell/HswcellDjango/Hswcell/wsgi.py'.
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] Traceback (most recent call last):
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] File "/home/rock/webapps/hswcell/lib/python2.7/django/core/handlers/wsgi.py", line 236, in __call__
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] self.load_middleware()
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] File "/home/rock/webapps/hswcell/lib/python2.7/django/core/handlers/base.py", line 45, in load_middleware
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] File "/home/rock/webapps/hswcell/lib/python2.7/django/conf/__init__.py", line 52, in __getattr__
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] self._setup(name)
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] File "/home/rock/webapps/hswcell/lib/python2.7/django/conf/__init__.py", line 47, in _setup
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] self._wrapped = Settings(settings_module)
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] File "/home/rock/webapps/hswcell/lib/python2.7/django/conf/__init__.py", line 132, in __init__
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Mon Dec 29 20:30:55 2014] [error] [client 127.0.0.1] ImportError: Could not import settings 'Hswcell.settings' (Is it on sys.path?): No module named Hswcell.settings
如果服务器可以找到wsgi.py路径,则无法找到位于同一目录下的settings.py文件。
答案 0 :(得分:0)
终于摆脱了错误。
我无法将设置目录添加到python路径, 这是我最终如何做到的
Adding to sys.path from httpd.conf
For web applications running on mod_wsgi, the Python module search path can be amended in the httpd.conf file, found in /home/username/webapps/appname/apache2/conf/. The file contains a line like this:
WSGIDaemonProcess app_name processes=5 python-path=/home/username/webapps/app_name:/home/username/webapps/app_name/lib/python2.7 threads=1