【问题标题】:django runserver start downlonding file containing this string <function render at 0x0000023B61F4F160>django runserver 开始下载包含此字符串的文件 <function render at 0x0000023B61F4F160>
【发布时间】:2021-02-25 05:44:07
【问题描述】:

运行后:py manage.py runserver 这个字符串显示在页面上,而不是显示 html 视图:

几分钟后,此消息出现在终端上:

[2020 年 11 月 13 日 08:39:05]“GET /socketcluster/HTTP/1.1”404 2129

【问题讨论】:

    标签: python html django render


    【解决方案1】:

    错误的语法

    解决方案: from django.shortcuts 导入渲染

    从 django.http 导入 HttpResponse

    在此处创建您的视图。

    定义索引(请求):

    return render (request, 'homepage/index.html')
    

    在我写之前 return HtppResponse(render, 'homepage/index.html')

    【讨论】:

      猜你喜欢
      • 2014-05-21
      • 1970-01-01
      • 2017-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-10
      • 1970-01-01
      相关资源
      最近更新 更多