2

Ubuntu のローカル マシンで Django サイトを使用していて、アップロードしたばかりですが、500 内部サーバー エラーが発生し、理由を理解できません。

一部のモジュールが表示されないようです。設定ファイルが表示されていない可能性がありますか? 以下は、この問題のエラー ログです。何が起こっているのかを明らかにしている可能性があります。

    [Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10] mod_wsgi (pid=23248): Exception occurred processing WSGI script '/var/www/kaasib/pypr$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10] Traceback (most recent call last):
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 24$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     response = self.get_response(request)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 17$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 22$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return debug.technical_500_response(request, *exc_info)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 66, in te$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     html = reporter.get_traceback_html()
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 276, in g$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return t.render(c)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 140, in$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return self._render(context)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 134, in$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return self.nodelist.render(context)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 823, in$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     bit = self.render_node(node, context)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 74, in$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return node.render(context)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 84, in$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     output = self.filter_expression.resolve(context)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 599, in$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     new_obj = func(obj, *arg_vals)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", li$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return format(value, arg)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 310,$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return df.format(format_string)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 33, $
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     pieces.append(force_unicode(getattr(self, piece)()))
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 214,$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return self.format('D, j M Y H:i:s O')
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 33, $
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     pieces.append(force_unicode(getattr(self, piece)()))
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", line 71, in$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     s = unicode(s)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 121,$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return func(*self.__args, **self.__kw)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py",$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return _trans.ugettext(message)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     return do_translate(message, 'ugettext')
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     _default = translation(settings.LANGUAGE_CODE)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     default_translation = _fetch(settings.LANGUAGE_CODE)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     app = import_module(appname)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]   File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, i$
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10]     __import__(name)
[Sat Dec 29 02:59:37 2012] [error] [client 139.190.233.10] ImportError: No module named company

httpd.conf ファイルの内容は次のとおりです。

WSGIPythonPath /var/www/kaasib/pyproject/kaasib/

<Directory /var/www/kaasib/pyproject/kaasib/kaasib/>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>

WSGISCRIPTAlis 行は、サイトで利用可能な vhost ファイルにあります。wsgi ファイルの内容は次のとおりです。

"""
WSGI config for kaasib project.

This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.

Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.

"""
import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kaasib.settings")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
4

3 に答える 3

1

アプリのapacheconfファイルとwsgiconfファイルを確認すると便利です。

あなたが提案したように、あなたの会社のモジュールが見つからないようです。それは多くの理由による可能性があります。まず、WSGIPythonPathをチェックし、アプリが含まれていることを確認します。

詳細については、DjangoWSGIデプロイメントガイドを参照してください。

于 2012-12-28T22:46:51.120 に答える
1

あなたのプロジェクトが pythonpath にないように思えます。これを wsgi.py の先頭に追加してみて、どうなるか見てみましょう:

import os, sys

path = '/path-to/your/project-root/'
if path not in sys.path:
   sys.path.append(path)
于 2012-12-29T03:36:10.743 に答える
0

モジュールをpipまたはその他の方法でリモートサーバーにインストールしましたか?モジュール名companyが見つからないだけです。また、設定ファイルのインストール済みINSTALLED_APPSに「Company」モジュールが含まれていることを確認してください。

于 2012-12-28T22:49:17.920 に答える