@Romanuss

Ошибка Flask — UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0?

Здравствуйте, при попытке запустить готовый сайт на flask вылазит ошибка:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Как можно от неё избавиться?
Логи серва:
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 639-283-580
2019-06-19 11:01:17,287 INFO sqlalchemy.engine.base.Engine SHOW VARIABLES LIKE 'sql_mode'
2019-06-19 11:01:17,288 INFO sqlalchemy.engine.base.Engine ()
2019-06-19 11:01:17,333 INFO sqlalchemy.engine.base.Engine SELECT DATABASE()
2019-06-19 11:01:17,334 INFO sqlalchemy.engine.base.Engine ()
2019-06-19 11:01:17,351 INFO sqlalchemy.engine.base.Engine show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'
2019-06-19 11:01:17,352 INFO sqlalchemy.engine.base.Engine ()
2019-06-19 11:01:17,358 INFO sqlalchemy.engine.base.Engine SELECT CAST('test plain returns' AS CHAR(60)) AS anon_1
2019-06-19 11:01:17,359 INFO sqlalchemy.engine.base.Engine ()
2019-06-19 11:01:17,363 INFO sqlalchemy.engine.base.Engine SELECT CAST('test unicode returns' AS CHAR(60)) AS anon_1
2019-06-19 11:01:17,366 INFO sqlalchemy.engine.base.Engine ()
2019-06-19 11:01:17,371 INFO sqlalchemy.engine.base.Engine SELECT CAST('test collated returns' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin AS anon_1
2019-06-19 11:01:17,373 INFO sqlalchemy.engine.base.Engine ()
2019-06-19 11:01:17,384 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2019-06-19 11:01:17,387 INFO sqlalchemy.engine.base.Engine SELECT revisions.id AS revisions_id, revisions.datetime AS revisions_datetime 
FROM revisions ORDER BY revisions.datetime DESC 
 LIMIT %s
2019-06-19 11:01:17,388 INFO sqlalchemy.engine.base.Engine (1,)
2019-06-19 11:01:17,425 INFO sqlalchemy.engine.base.Engine SELECT universities.id AS universities_id, universities.name AS universities_name 
FROM universities 
WHERE universities.name = %s
2019-06-19 11:01:17,427 INFO sqlalchemy.engine.base.Engine ('\xd0\xa5\xd0\xb5\xd1\x80\xd1\x81\xd0\xbe\xd0\xbd\xd1\x81\xd1\x8c\xd0\xba\xd0\xb8\xd0\xb9 \xd0\xb4\xd0\xb5\xd1\x80\xd0\xb6\xd0\xb0\xd0\xb2\xd0\xbd\xd0\xb8\xd0\xb9 \xd1\x83\xd0\xbd\xd1\x96\xd0\xb2\xd0\xb5\xd1\x80\xd1\x81\xd0\xb8\xd1\x82\xd0\xb5\xd1\x82',)
127.0.0.1 - - [19/Jun/2019 11:01:18] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/roman/myproject/rating/app/main/views.py", line 56, in index
    error=error)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 134, in render_template
    context, ctx.app)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 116, in _render
    rv = template.render(context)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/roman/myproject/rating/app/templates/main/index.html", line 1, in top-level template code
    {% extends "layouts/main.html" %}
  File "/home/roman/myproject/rating/app/templates/layouts/main.html", line 38, in top-level template code
    {% block content %}
  File "/home/roman/myproject/rating/app/templates/layouts/main.html", line 44, in block "content"
    {% block right_column %}{% endblock %}
  File "/home/roman/myproject/rating/app/templates/main/index.html", line 109, in block "right_column"
    {% include "main/_contact.html" %}
  File "/home/roman/myproject/rating/app/templates/main/_contact.html", line 9, in top-level template code
    <label>{{ field.label.text }}{% if field.flags.required %} <sup style="color: red;">*</sup>{% endif %}</label>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
127.0.0.1 - - [19/Jun/2019 11:01:18] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
127.0.0.1 - - [19/Jun/2019 11:01:18] "GET /?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
127.0.0.1 - - [19/Jun/2019 11:01:18] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
127.0.0.1 - - [19/Jun/2019 11:01:19] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
127.0.0.1 - - [19/Jun/2019 11:01:19] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
  • Вопрос задан
  • 31 просмотр
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы