2

Ubuntu (EC2 インスタンス) の本番環境で django プロジェクトを設定しようとしていますが、以下のエラーが発生します。私の道は 100% 正しいです。同じ種類の問題で他のスタックオーバーフローの質問を調べましたが、どれも役に立たないようです。私は別の問題を抱えている可能性があると考えています。

誰かが何か間違ったことを見つけたり、このエラーを引き起こす私の問題を知ったりできますか?

**Django 1.5 を実行中

Ubuntu 12.04.2 LTS**

エラー:

ファイル "/usr/local/lib/python2.7/dist-packages/django/conf/_ init _.py"、132 行目、_ init _ raise ImportError("Could not import settings '%s' (それはsys.path?): %s" % (self.SETTINGS_MODULE, e)) [client 37.191.99.202] ImportError: 設定 'live.settings' をインポートできませんでした (sys.path にありますか?): ビリヤードという名前のモジュールはありません.例外

wsgi

import os, sys
sys.path.append('/srv/projects/liveSMS')
sys.path.append('/srv/projects/liveSMS.live')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "live.settings")


import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

サイト (実際のドメインではなく domain.com)

<VirtualHost *:80>
   ServerName  domain.com
   ServerAlias domain.com

   DocumentRoot /srv/projects/liveSMS/public

   WSGIScriptAlias / /srv/projects/liveSMS/apache/django.wsgi
   <Directory /srv/projects/liveSMS/>
      Order allow,deny
      Allow from all
   </Directory>

    Alias /robots.txt /srv/projects/liveSMS/public/robots.txt
    Alias /static /srv/projects/liveSMS/static

     ErrorLog /srv/projects/liveSMS/logs/error.log
</VirtualHost>

フルエラー

[Tue Mar 19 10:31:40 2013] [error] [client 37.191.99.202]     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Tue Mar 19 10:31:40 2013] [error] [client 37.191.99.202] ImportError: Could not import settings 'live/settings' (Is it on sys.path?): Import by filename is not supported.
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202] mod_wsgi (pid=1488): Exception occurred processing WSGI script '/srv/projects/liveSMS/apache/django.wsgi'.
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202] Traceback (most recent call last):
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 236, in __call__
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]     self.load_middleware()
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]     for middleware_path in settings.MIDDLEWARE_CLASSES:
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 52, in __getattr__
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]     self._setup(name)
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 47, in _setup
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]     self._wrapped = Settings(settings_module)
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202]     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Tue Mar 19 10:39:14 2013] [error] [client 37.191.99.202] ImportError: Could not import settings 'live.settings' (Is it on sys.path?): No module named billiard.exceptions
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202] mod_wsgi (pid=1656): Exception occurred processing WSGI script '/srv/projects/liveSMS/apache/django.wsgi'.
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202] Traceback (most recent call last):
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 236, in __call__
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]     self.load_middleware()
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]     for middleware_path in settings.MIDDLEWARE_CLASSES:
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 52, in __getattr__
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]     self._setup(name)
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 47, in _setup
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]     self._wrapped = Settings(settings_module)
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202]     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Tue Mar 19 11:14:53 2013] [error] [client 37.191.99.202] ImportError: Could not import settings 'live.settings' (Is it on sys.path?): No module named billiard.exceptions
4

1 に答える 1

1

おそらくあなたの設定では、パス /srv/projects/liveSMS と /srv/projects/liveSMS.live が PYTHONPATH 変数に含まれている必要があります。

たとえば、Apache ウェブサーバーを起動するユーザーの .bashrc ファイルに永続的に追加できます。

PYTHONPATH='/srv/projects/liveSMS/:/srv/projects/liveSMS.live/'.

提案されたソリューションが最適かどうかはわかりません。しかし、それはうまくいく可能性があります。

于 2013-03-19T12:51:11.593 に答える