解決できない Django エラーについて助けが必要です。
「python manage.py runserver」を実行すると、私の Web サイトは非常にうまく機能しますが、wsgi を使用してデプロイしようとすると、不明なエラーが発生し続けます。これらのエラーをググってみましたが、解決できません。誰が私のエラーが何であるかを教えてもらえますか?
Apache エラー ログ
[error] /usr/local/lib/python2.6/dist-packages/django/middleware/csrf.py:262: DeprecationWarning: CsrfResponseMiddleware and CsrfMiddleware are deprecated; use CsrfViewMiddleware and the template tag instead (see CSRF documentation).
[error] DeprecationWarning
[error] [client 76.191.24.242] mod_wsgi (pid=21082): Exception occurred processing WSGI script '/srv/www/myapp/wsgi.py'.
[error] [client 76.191.24.242] Traceback (most recent call last):
[error] [client 76.191.24.242] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 250, in __call__
[error] [client 76.191.24.242] self.load_middleware()
[error] [client 76.191.24.242] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 47, in load_middleware
[error] [client 76.191.24.242] raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[error] [client 76.191.24.242] ImproperlyConfigured: Error importing middleware backends: "No module named models"
wsgi.py
import os
import sys
sys.path.append('/srv/www')
sys.path.append('/srv/www/myapp')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
アパッチ
<VirtualHost *:80>
ServerName www.myapp.com
DocumentRoot /srv/www/myapp
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.myapp.com$ [NC]
RewriteRule ^(.*)$ http://www.myapp.com$1 [R,L]
Alias /static/ /srv/www/myapp/static/
<Directory /srv/www/myapp>
Order allow,deny
Allow from all
</Directory>
<Directory /srv/www/myapp/static>
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess myapp.djangoserver processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup myapp.djangoserver
WSGIScriptAlias / /srv/www/myapp/wsgi.py
</VirtualHost>