机构课程没有显示数据

来源:10-15 机构课程和机构介绍页面开发

Hanamichi520

2020-08-30

 <div class="brief group_list">
            {% for coures in all_courses.object_list %}
                <div class="module1_5 box">
                    <a class="comp-img-box" href="{% url 'organization:course' course.id %}">
                        <img width="214" height="195" src="{{ coures.image.url }}" alt=""/>
                    </a>
                    <div class="des">
                        <a href="{% url 'organization:course' course.id %}"><h2>{{ coures.name }}</h2></a>
                        <span class="fl">课时:<i class="key">{{ coures.learn_times }}</i></span>
                        <span class="fr">学习人数:{{ coures.students }}</span>
                    </div>
                    <div class="bottom">
                        <span class="fl">慕课网</span>
                        <span class="star fr  notlogin
                            " data-favid="13" data-fav-type="4">
                            {{ coures.fav_nums }}
                        </span>
                    </div>
                </div>
            {% endfor %}
        </div>

老师,{% for coures in all_courses.object_list %} 这里加上object_list,前端网页没有显示数据

图片描述

如果不加object_list 打开网页会报错。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\python\python38-32\lib\wsgiref\handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "C:\Users\86186\.virtualenvs\mx_online\lib\site-packages\django\contrib\staticfiles\handlers.py", line 65, in __call__
    return self.application(environ, start_response)
  File "C:\Users\86186\.virtualenvs\mx_online\lib\site-packages\django\core\handlers\wsgi.py", line 141, in __call__
    response = self.get_response(request)
  File "C:\Users\86186\.virtualenvs\mx_online\lib\site-packages\django\core\handlers\base.py", line 75, in get_response
    response = self._middleware_chain(request)
  File "C:\Users\86186\.virtualenvs\mx_online\lib\site-packages\django\core\handlers\exception.py", line 36, in inner
    response = response_for_exception(request, exc)
  File "C:\Users\86186\.virtualenvs\mx_online\lib\site-packages\django\core\handlers\exception.py", line 90, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "C:\Users\86186\.virtualenvs\mx_online\lib\site-packages\django\core\handlers\exception.py", line 125, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "C:\Users\86186\.virtualenvs\mx_online\lib\site-packages\django\views\debug.py", line 94, in technical_500_response
    html = reporter.get_traceback_html()
  File "C:\Users\86186\.virtualenvs\mx_online\lib\site-packages\django\views\debug.py", line 332, in get_traceback_html
    t = DEBUG_ENGINE.from_string(fh.read())
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 9737: illegal multibyte sequence

请老师指点一下?该问题如何解决。

写回答

1回答

bobby

2020-08-31

这是django出现debug信息出来的bug你百度一下怎么修改django的源码 显示出具体的信息 网上有资料

0
0

Django+ xadmin 开发在线教育网站

一套通用的技术组合拳,助你解决大部分Python类网站后端问题

1911 学习 · 2149 问题

查看课程