1

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

私のdjango.wsgi:編集済み

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>
4

1 に答える 1

0
sys.path.append(rootpathofyoursite)

私の wsgi ファイルは私のサイトのルート パスにあるので、チートします。

sys.path.append(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))
于 2013-07-04T03:59:18.433 に答える