0

Здравствуйте! Возникает ошибка при обращении к базе.

    Nov  4 21:15:31 ubuntu [service_variant=lms][django.request][env:sandbox] ERROR [ubuntu  2291] [base.py:256] - Internal Server Error: /admin/certificates/certificatehtmlviewconfiguration/
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 164, in get_response
    response = response.render()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/response.py", line 158, in render
    self.content = self.rendered_content
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/response.py", line 135, in rendered_content
    content = template.render(context, self._request)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/backends/django.py", line 74, in render
    return self.template.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 210, in render
    return self._render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 202, in _render
    return self.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 135, in render
    return compiled_parent._render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 202, in _render
    return self.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 135, in render
    return compiled_parent._render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 202, in _render
    return self.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 65, in render
    result = block.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 65, in render
    result = block.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 1273, in render
    _dict = func(*resolved_args, **resolved_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_list.py", line 388, in date_hierarchy
    } for month in months]
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 162, in __iter__
    self._fetch_all()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 965, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 1217, in iterator
    for row in compiler.results_iter():
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 800, in results_iter
    row = self.apply_converters(row, converters)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 784, in apply_converters
    value = converter(value, expression, self.connection, self.query.context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/expressions.py", line 927, in convert_value
    "Database returned an invalid value in QuerySet.datetimes(). "
ValueError: Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?Nov  4 21:15:31 ubuntu [service_variant=lms][django.request][env:sandbox] ERROR [ubuntu  2291] [base.py:256] - Internal Server Error: /admin/certificates/certificatehtmlviewconfiguration/
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 164, in get_response
    response = response.render()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/response.py", line 158, in render
    self.content = self.rendered_content
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/response.py", line 135, in rendered_content
    content = template.render(context, self._request)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/backends/django.py", line 74, in render
    return self.template.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 210, in render
    return self._render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 202, in _render
    return self.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 135, in render
    return compiled_parent._render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 202, in _render
    return self.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 135, in render
    return compiled_parent._render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 202, in _render
    return self.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 65, in render
    result = block.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 65, in render
    result = block.nodelist.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 905, in render
    bit = self.render_node(node, context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 919, in render_node
    return node.render(context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/template/base.py", line 1273, in render
    _dict = func(*resolved_args, **resolved_kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_list.py", line 388, in date_hierarchy
    } for month in months]
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 162, in __iter__
    self._fetch_all()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 965, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 1217, in iterator
    for row in compiler.results_iter():
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 800, in results_iter
    row = self.apply_converters(row, converters)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 784, in apply_converters
    value = converter(value, expression, self.connection, self.query.context)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/expressions.py", line 927, in convert_value
    "Database returned an invalid value in QuerySet.datetimes(). "
ValueError: Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?

установил время на сервере на utc (Europe/Kiev) при помощи dpkg-reconfigure tzdata

добавил в /etc/mysql/my.cnf после [mysqld] строку default-time-zone = 'UTC'

Рестартнул Mysql и сделал mysql -u root -p -e "flush tables;" mysql, но ничего не изменилось, уже голову сломал. Помогите пожалуйста.

4
  • 1
    Работает ли import pytz в вашем virtualenv, в котором ошибку получили? Чтобы установить (если системные пакеты видны): sudo apt-get install python{,3}-tz иначе: pip install pytz. Не стесняйтесь полный traceback приводить--это может с отладкой помочь.
    – jfs
    Commented 4 нояб. 2016 в 21:31
  • проблема в том, что на аналогичной платформе, развернутой в виртуали все работает..
    – Danylo
    Commented 4 нояб. 2016 в 22:36
  • @jfs, добавил полный трейсбек
    – Danylo
    Commented 4 нояб. 2016 в 22:36
  • решил проблему другим способом, ссылку прилагаю ссылка
    – Danylo
    Commented 5 нояб. 2016 в 14:22

1 ответ 1

0

Решение данного вопроса описано на офф группе дискуссий платформы OpenEdx

Ссылка прилагается

General Openedx discussion

Проблема состояла в том, что не было доступа в админку генерации сертификатов в платформе OpenEdx

Решение

  1. Выставляем временную зону в lms.env.json и cms.env.json
    "TIME_ZONE": "Europe/Kiev",
  2. Конфигурируем время в убунте dpkg-reconfigure tzdata
  3. Добавляем настройки часового пояса сюда
    • /etc/my.cnf
    • default-time-zone = 'Europe/Kiev'
  4. Актуализируем базы
    • mysql_tzinfo_to_sql /usr/share/zoneinfo | sed -e "s/Local time zone must be set--see zic manual page/local/" | mysql -u root mysql
    • mysql_tzinfo_to_sql /usr/share/zoneinfo/Europe/Kiev 'Europe/Kiev'
    • mysql -u root -p -e "flush tables;" mysql
  5. Создаем папку для сертификатов
    • Редактируем файл /etc/init/mounted-tmp.conf
      mkdir /tmp/certificates chown -R www-data:www-data /tmp/certificates
  6. Редактируем файлы {cms/lms}.env.json и добавляем туда в раздел FEATURES: строку "CERTIFICATES_HTML_VIEW": true,
  7. Синхронизируем БД sudo su edxapp -s /bin/bash cd ~ source edxapp_env python /edx/app/edxapp/edx-platform/manage.py cms syncdb --settings=aws python /edx/app/edxapp/edx-platform/manage.py lms syncdb --settings=aws

  8. Перезапускаем все сервисы командой sudo /edx/bin/supervisorctl restart all

0

Ваш ответ

Нажимая «Отправить ответ», вы соглашаетесь с условиями пользования и подтверждаете, что прочитали политику конфиденциальности.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.