2016-09-08 8 views
0

私は私のウェブサイトで500エラーを返すと思います。WSGI:Django Appが必要なサイトパッケージを取得していません

Apacheのログは実際には具体的なものではないので、私は本当に何をすべきか分かりません。 apt-getをアップグレードする前に、すべて正常に動作しました。

これは許可エラーと思われます。 WSGIで動作する権限を設定するにはどうすればよいですか?

また、なぜこの問題が別の理由で発生する可能性があるか知っていますか?

のapacheのconf:

... 
WSGIDaemonProcess aegee-stuttgart.org python-path=/home/sysadmin/public_html/aegee-stuttgart.org:/home/sysadmin/.virtualenvs/django/lib/python2.7 
    WSGIProcessGroup aegee-stuttgart.org 
    WSGIScriptAlias//home/sysadmin/public_html/aegee-stuttgart.org/aegee/wsgi.py 
... 

wsgi.py:

... 
import os, sys 

# add the aegee project path into the sys.path 
sys.path.append('/home/sysadmin/public_html/aegee-stuttgart.org/aegee') 

# add the virtualenv site-packages path to the sys.path 
sys.path.append('/home/sysadmin/.virtualenvs/django/lib/python2.7/site-packages') 
import django 
from django.core.handlers.wsgi import WSGIHandler 
... 

のerror.log:

mod_wsgi (pid=23202): Exception occurred processing WSGI script '/home/sysadmin/p$ 
Traceback (most recent call last): 
File "/home/sysadmin/public_html/aegee-stuttgart.org/aegee/wsgi.py", line 31, i$ 
    return super(WSGIEnvironment, self).__call__(environ, start_response) 
File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 189,$ 
    response = self.get_response(request) 
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 218,$ 
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) 
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 264,$ 
    if resolver.urlconf_module is None: 
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 395, $ 
    self._urlconf_module = import_module(self.urlconf_name) 
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module 
    __import__(name) 
File "/home/sysadmin/public_html/aegee-stuttgart.org/aegee/urls.py", line 8, in$ 
    from .userprofile.views import AccountPersonalInfoView 
File "/home/sysadmin/public_html/aegee-stuttgart.org/aegee/userprofile/views.py$ 
    from django.contrib.auth.mixins import LoginRequiredMixin 
ImportError: No module named mixins 
+0

最終行に 'django.contrib.auth.mixins import LoginRequiredMixin - ImportError:mixinsという名前のモジュールはありません。 Django 1.9.x以降を実行していますか? – C14L

+0

私はdjango 1.9.9をvirtualenvで実行していますが、明らかにwsgiはそれを認識しません。これを修正する方法については何の手掛かりもありません。 – setchock

+0

以前のバージョンのDjangoモジュールが使用されているようです。 'sys.path'です。おそらく 'wsgi.py'では、最後に追加する代わりに、_first_エントリとしてvirtualenvサイトパッケージディレクトリを挿入することができますか? –

答えて

1

用途:

WSGIDaemonProcess aegee-stuttgart.org python-home=/home/sysadmin/.virtualenvs/django python-path=/home/sysadmin/public_html/aegee-stuttgart.org 

あなたが持っていたものではありません。 python-pathを使用して仮想環境を参照することはできますが、間違ったディレクトリを使用していました。代わりにpython-homeを使用して、仮想環境用のsys.prefixと同じディレクトリに設定します。

間違ったディレクトリを使用していたため、仮想環境ではなくPythonのメインインストールからDjangoを取得していました。

関連する問題