Graphite-Web и Ubuntu 18.04

Я пытаюсь настроить graphite-web в только что установленной системе Ubuntu 18.04. Я использовал менеджер пакетов apt, поэтому получил версию Graphite-Web 1.0.2. Я закончил настройку как обычно, однако я получил "Внутреннюю ошибку сервера" при попытке открыть графическую сеть в браузере. Журнал ошибок Apache графитовой сети говорит:

[Fri May 25 07:02:47.097839 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX] mod_wsgi (pid=13350): Exception occurred processing WSGI script '/usr/share/graphite-web/graphite.wsgi'.
[Fri May 25 07:02:47.102111 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX] Traceback (most recent call last):
[Fri May 25 07:02:47.102210 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 157, in __call__
[Fri May 25 07:02:47.102389 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]     response = self.get_response(request)
[Fri May 25 07:02:47.102535 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 124, in get_response
[Fri May 25 07:02:47.102706 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]     response = self._middleware_chain(request)
[Fri May 25 07:02:47.102964 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 43, in inner
[Fri May 25 07:02:47.103063 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]     response = response_for_exception(request, exc)
[Fri May 25 07:02:47.103144 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 93, in response_for_exception
[Fri May 25 07:02:47.103263 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]     response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
[Fri May 25 07:02:47.103502 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 143, in handle_uncaught_exception
[Fri May 25 07:02:47.103660 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]     return callback(request, **param_dict)
[Fri May 25 07:02:47.103737 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/graphite/views.py", line 11, in server_error
[Fri May 25 07:02:47.103889 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]     return HttpResponseServerError( template.render(context) )
[Fri May 25 07:02:47.104044 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/template/backends/django.py", line 64, in render
[Fri May 25 07:02:47.104484 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]     context = make_context(context, request, autoescape=self.backend.engine.autoescape)
[Fri May 25 07:02:47.104582 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/template/context.py", line 287, in make_context
[Fri May 25 07:02:47.104868 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX]     raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__)
[Fri May 25 07:02:47.105070 2018] [wsgi:error] [pid 13350] [remote XXX.XXX.XXX.XXX:XXXX] TypeError: context must be a dict rather than Context.
[Fri May 25 07:02:47.435785 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX] mod_wsgi (pid=13387): Exception occurred processing WSGI script '/usr/share/graphite-web/graphite.wsgi'.
[Fri May 25 07:02:47.436040 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX] Traceback (most recent call last):
[Fri May 25 07:02:47.436131 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 157, in __call__
[Fri May 25 07:02:47.436272 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]     response = self.get_response(request)
[Fri May 25 07:02:47.436386 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 124, in get_response
[Fri May 25 07:02:47.436646 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]     response = self._middleware_chain(request)
[Fri May 25 07:02:47.436744 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 43, in inner
[Fri May 25 07:02:47.436876 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]     response = response_for_exception(request, exc)
[Fri May 25 07:02:47.437023 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 93, in response_for_exception
[Fri May 25 07:02:47.437173 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]     response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
[Fri May 25 07:02:47.437321 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 143, in handle_uncaught_exception
[Fri May 25 07:02:47.437570 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]     return callback(request, **param_dict)
[Fri May 25 07:02:47.437755 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/graphite/views.py", line 11, in server_error
[Fri May 25 07:02:47.437960 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]     return HttpResponseServerError( template.render(context) )
[Fri May 25 07:02:47.438139 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/template/backends/django.py", line 64, in render
[Fri May 25 07:02:47.438273 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]     context = make_context(context, request, autoescape=self.backend.engine.autoescape)
[Fri May 25 07:02:47.438392 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]   File "/usr/lib/python2.7/dist-packages/django/template/context.py", line 287, in make_context
[Fri May 25 07:02:47.438609 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX]     raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__)
[Fri May 25 07:02:47.438816 2018] [wsgi:error] [pid 13387] [remote XXX.XXX.XXX.XXX:XXXX] TypeError: context must be a dict rather than Context.

Сначала я подумал, что каталог, содержащий скрипт wsgi, не принадлежит нужному пользователю, но оказалось, что это не так. (Принадлежит пользователю веб-сервера)

В настоящее время я использую Python 2.7, но я смог воспроизвести проблему с помощью Python3.

У меня заканчиваются идеи. Кто-нибудь может помочь?

Спасибо!

1 ответ

Мне удалось решить эту проблему внутри usr/lib/python2.7/dist-packages/graphite/views.py

путем изменения

  context = Contex({
    'stacktrace' : traceback.format_exc()
  })

в

  context = {
    'stacktrace' : traceback.format_exc()
  }

Проблема была связана с этой темой: контекст Django 1.11 TypeError должен быть скорее dict, чем Context

Другие вопросы по тегам