使用 pip 更新 Whisper 包(从 0.9.12 到 1.1.1)后,我无法再访问我的 Graphite 实例(即使在降级之后......)日志说目标脚本无法作为Python 模块。
以下是有关系统的一些信息。
- Python版本:2.7
- 碳、石墨网、耳语版本:0.9.12
我尝试更改权限,/usr/share/graphite-web/graphite.wsgi
但/opt/graphite/conf/graphite.wsgi
并没有解决问题。
我的错误日志:
[Thu Jan 18 14:53:17.260272 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] mod_wsgi (pid=16527): Target WSGI script '/usr/share/graphite-web/graphite.wsgi' cannot be loaded as Python module.
[Thu Jan 18 14:53:17.260431 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] mod_wsgi (pid=16527): Exception occurred processing WSGI script '/usr/share/graphite-web/graphite.wsgi'.
[Thu Jan 18 14:53:17.260470 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] Traceback (most recent call last):
[Thu Jan 18 14:53:17.260507 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] File "/usr/share/graphite-web/graphite.wsgi", line 16, in <module>
[Thu Jan 18 14:53:17.260552 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] application = get_wsgi_application()
[Thu Jan 18 14:53:17.260564 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Thu Jan 18 14:53:17.260586 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] django.setup(set_prefix=False)
[Thu Jan 18 14:53:17.260597 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
[Thu Jan 18 14:53:17.260630 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] apps.populate(settings.INSTALLED_APPS)
[Thu Jan 18 14:53:17.260651 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 78, in populate
[Thu Jan 18 14:53:17.260670 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] raise RuntimeError("populate() isn't reentrant")
[Thu Jan 18 14:53:17.260695 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] RuntimeError: populate() isn't reentrant
这是/usr/share/graphite-web/graphite.wsgi
(与我的相同/opt/graphite/webapp/wsgi.py
)的内容
import os
import sys
sys.path.append('/opt/graphite/webapp')
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphite.settings') # noqa
from django.conf import settings
from django.core.wsgi import get_wsgi_application
from graphite.logger import log
application = get_wsgi_application()
try:
import whitenoise
except ImportError:
whitenoise = False
else:
# WhiteNoise < 2.0.1 does not support Python 2.6
if sys.version_info[:2] < (2, 7):
whitenoise_version = tuple(map(
int, getattr(whitenoise, '__version__', '0').split('.')))
if whitenoise_version < (2, 0, 1):
whitenoise = False
if whitenoise:
from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(application)
prefix = "/".join((settings.URL_PREFIX.strip('/'), 'static'))
for directory in settings.STATICFILES_DIRS:
application.add_files(directory, prefix=prefix)
for app_path in settings.INSTALLED_APPS:
module = import_module(app_path)
directory = os.path.join(os.path.dirname(module.__file__), 'static')
if os.path.isdir(directory):
application.add_files(directory, prefix=prefix)
# Initializing the search index can be very expensive. The import below
# ensures the index is preloaded before any requests are handed to the
# process.
log.info("graphite.wsgi - pid %d - reloading search index" % os.getpid())
import graphite.metrics.search # noqa
我还有一个文件/opt/graphite/conf/graphite.wsgi:
import sys
sys.path.append('/opt/graphite/webapp')
from graphite.wsgi import application
我对 wsgi 了解不多,也看不懂这些日志。需要帮助...非常感谢。