错误日志重启1次请求,由于某种原因似乎无法加载“中间件”?对于设置和一般的设置文件。这可能与权限或仅仅是我的配置有关吗?
[Wed Jul 03 22:44:42 2013] [notice] Apache/2.2.14 (Ubuntu) mod_wsgi/2.8 Python/2.6.5 configured -- resuming normal operations
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] mod_wsgi (pid=6165): Exception occurred processing WSGI script '/srv/www/quickerhub.com/interest/django.wsgi'.
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] Traceback (most recent call last):
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/core/handlers/wsgi.py", line 236, in __call__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] self.load_middleware()
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/core/handlers/base.py", line 45, in load_middleware
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 53, in __getattr__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] self._setup(name)
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 48, in _setup
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] self._wrapped = Settings(settings_module)
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 134, in __init__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named settings
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] mod_wsgi (pid=6166): Exception occurred processing WSGI script '/srv/www/quickerhub.com/interest/django.wsgi'.
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] Traceback (most recent call last):
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/core/handlers/wsgi.py", line 236, in __call__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] self.load_middleware()
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/core/handlers/base.py", line 45, in load_middleware
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 53, in __getattr__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] self._setup(name)
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 48, in _setup
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] self._wrapped = Settings(settings_module)
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/conf/__init__.py", line 134, in __init__
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Wed Jul 03 22:44:45 2013] [error] [client 74.192.126.252] ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named settings
我的文件结构:
.
├── logfile
└── srv
├── logfile
└── www
└── quickerhub.com
├── admin
│ ├── css
│ │ ├── base.css
│ │ ├── changelists.css
│ │ ├── dashboard.css
│ │ ├── forms.css
│ │ ├── ie.css
│ │ ├── login.css
│ │ ├── rtl.css
│ │ └── widgets.css
│ ├── img
│ │ ├── changelist-bg.gif
│ │ ├── changelist-bg_rtl.gif
│ │ ├── chooser-bg.gif
│ │ ├── chooser_stacked-bg.gif
│ │ ├── default-bg.gif
│ │ ├── default-bg-reverse.gif
│ │ ├── deleted-overlay.gif
│ │ ├── gis
│ │ │ ├── move_vertex_off.png
│ │ │ └── move_vertex_on.png
│ │ ├── icon_addlink.gif
│ │ ├── icon_alert.gif
│ │ ├── icon_calendar.gif
│ │ ├── icon_changelink.gif
│ │ ├── icon_clock.gif
│ │ ├── icon_deletelink.gif
│ │ ├── icon_error.gif
│ │ ├── icon-no.gif
│ │ ├── icon_searchbox.png
│ │ ├── icon_success.gif
│ │ ├── icon-unknown.gif
│ │ ├── icon-yes.gif
│ │ ├── inline-delete-8bit.png
│ │ ├── inline-delete.png
│ │ ├── inline-restore-8bit.png
│ │ ├── inline-restore.png
│ │ ├── inline-splitter-bg.gif
│ │ ├── nav-bg.gif
│ │ ├── nav-bg-grabber.gif
│ │ ├── nav-bg-reverse.gif
│ │ ├── nav-bg-selected.gif
│ │ ├── selector-icons.gif
│ │ ├── selector-search.gif
│ │ ├── sorting-icons.gif
│ │ ├── tool-left.gif
│ │ ├── tool-left_over.gif
│ │ ├── tool-right.gif
│ │ ├── tool-right_over.gif
│ │ ├── tooltag-add.gif
│ │ ├── tooltag-add_over.gif
│ │ ├── tooltag-arrowright.gif
│ │ └── tooltag-arrowright_over.gif
│ └── js
│ ├── actions.js
│ ├── actions.min.js
│ ├── admin
│ │ ├── DateTimeShortcuts.js
│ │ ├── ordering.js
│ │ └── RelatedObjectLookups.js
│ ├── calendar.js
│ ├── collapse.js
│ ├── collapse.min.js
│ ├── core.js
│ ├── getElementsBySelector.js
│ ├── inlines.js
│ ├── inlines.min.js
│ ├── jquery.init.js
│ ├── jquery.js
│ ├── jquery.min.js
│ ├── LICENSE-JQUERY.txt
│ ├── prepopulate.js
│ ├── prepopulate.min.js
│ ├── SelectBox.js
│ ├── SelectFilter2.js
│ ├── timeparse.js
│ └── urlify.js
├── interest
│ ├── django.wsgi
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── settings.py
│ ├── settings.pyc
│ ├── urls.py
│ └── wsgi.py
├── js
│ └── jquery-1.10.1.min.js
├── logfile
├── manage.py
├── README
├── reoccurring
│ ├── admin.py
│ ├── forms.py
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── models.py
│ ├── models.pyc
│ ├── usagelib.py
│ └── views.py
├── schedule
│ ├── admin.py
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── models.py
│ ├── models.pyc
│ ├── tests.py
│ ├── usagelib.py
│ └── views.py
├── src
│ ├── facebooksdk
│ │ ├── examples
│ │ │ ├── appengine
│ │ │ │ ├── app.yaml
│ │ │ │ ├── example.html
│ │ │ │ └── example.py
│ │ │ ├── newsfeed
│ │ │ │ ├── app.yaml
│ │ │ │ ├── facebookclient.py
│ │ │ │ ├── static
│ │ │ │ │ ├── base.css
│ │ │ │ │ ├── favicon.ico
│ │ │ │ │ └── robots.txt
│ │ │ │ └── templates
│ │ │ │ ├── base.html
│ │ │ │ ├── home.html
│ │ │ │ └── index.html
│ │ │ ├── oauth
│ │ │ │ ├── app.yaml
│ │ │ │ ├── facebookoauth.py
│ │ │ │ └── oauth.html
│ │ │ └── tornado
│ │ │ ├── example.html
│ │ │ ├── example.py
│ │ │ └── schema.sql
│ │ ├── facebook.py
│ │ ├── facebook_sdk.egg-info
│ │ │ ├── dependency_links.txt
│ │ │ ├── PKG-INFO
│ │ │ ├── SOURCES.txt
│ │ │ └── top_level.txt
│ │ ├── MANIFEST.in
│ │ ├── README.rst
│ │ └── setup.py
│ └── pip-delete-this-directory.txt
├── static
│ └── js
│ └── jquery-1.10.1.min.js
├── templates
│ ├── 404.html
│ ├── 500.html
│ ├── Base.html
│ ├── Home.html
│ ├── Reoccurring.html
│ └── Usersettings.html
└── usersetting
├── admin.py
├── __init__.py
├── __init__.pyc
├── models.py
├── models.pyc
└── views.py
my django.wsgi:EDITED
import os
import sys
sys.path.append('/srv/www/quickerhub.com/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'interest.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
我的httpd.conf:
WSGIScriptAlias / /srv/www/quickerhub.com/interest/django.wsgi
<Directory /srv/www/quickerhub.com>
Order allow,deny
Allow from all
</Directory>
我的网站启用/ quickerhub.com:
WSGIPythonPath /srv/www/quickerhub.com
<VirtualHost *:80>
ServerName quickerhub.com
ServerAlias testing.quickerhub.com
Alias /static/ /srv/www/quickerhub.com/interest/static/
# Alias /sitemap.xml /srv/www/quickerhub.com/interest/static/sitemap.xml
WSGIScriptAlias / /srv/www/quickerhub.com/interest/django.wsgi
<Directory />
AllowOverride None
Options -Indexes
</Directory>
<Directory /srv/www/quickerhub.com/.git/>
Deny From All
</Directory>
</VirtualHost>
答案 0 :(得分:0)
sys.path.append(rootpathofyoursite)
我的wsgi文件位于我网站的根路径中,所以我作弊:
sys.path.append(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))