我最近设置了一个 Web 服务器,它目前托管了几个静态页面网站和两个 django 项目。
这两个 django 项目是“abc”和“xyz”,分别位于主文件夹中的不同目录中。每个都有自己的 wsgi 脚本,指向各自的 settings.py 文件。
不过最近,我注意到“xyz”上有几个 500 个错误。通常刷新会纠正问题,但这是不可接受的,所以我检查了 apache error.log,并注意到有时当我点击“xyz”时,会出现一个异常,即在 xyz 项目中找不到 abc.settings。不知何故,这两个项目正在交叉并相互干扰。我在 abc 上的工作还不够多,还不知道问题是否与其他方式相同。下面是我的例外。
[Sun Jul 08 13:30:34 2012] [error] Traceback (most recent call last):
[Sun Jul 08 13:30:34 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 219, in __call__
[Sun Jul 08 13:30:34 2012] [error] self.load_middleware()
[Sun Jul 08 13:30:34 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 39, in load_middleware
[Sun Jul 08 13:30:34 2012] [error] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Sun Jul 08 13:30:34 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 184, in inner
[Sun Jul 08 13:30:34 2012] [error] self._setup()
[Sun Jul 08 13:30:34 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 42, in _setup
[Sun Jul 08 13:30:34 2012] [error] self._wrapped = Settings(settings_module)
[Sun Jul 08 13:30:34 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 95, in __init__
[Sun Jul 08 13:30:34 2012] [error] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Sun Jul 08 13:30:34 2012] [error] ImportError: Could not import settings 'abc.settings' (Is it on sys.path?): No module named scalamoosh.settings
任何帮助/建议将不胜感激。干杯