zoukankan      html  css  js  c++  java
  • django(未解决的问题)

    1. can't compare datetime.datetime and datetime.date

    2.Django手册1.4中提到TEMPLATE_DIRS = ( '/home/project/mysite/templates/' )使用这种方法加载模板路径

    这是手册中的一个函数def index(request):

        latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
        t = loader.get_template('polls/index.html')
        c = Context({
            'latest_poll_list': latest_poll_list,
        })
        return HttpResponse(t.render(c))

    最终运行的时候报错 提示模板不存在,无法解决。
    最后还是按照vamei的做法:
    TEMPLATE_DIRS = (
       os.path.join(BASE_DIR, 'templates/polls/')
    )
    才未报错,谁知道为什么么?????

    3.    <li><a href="/polls/{{ poll.id }}/">{{ poll.question }}</a></li>,在红色处/和{之间有空格也会报错(url不匹配)



  • 相关阅读:
    mysql 基础sql语句
    mysql存储引擎概述
    docker命令总结
    python链接postgresql
    Log4.net示例
    postgresql 使用游标笔记
    npm常用命令
    Nginx命令
    Ubuntu命令总结
    NHibernate总结
  • 原文地址:https://www.cnblogs.com/gemini-huang/p/6642453.html
Copyright © 2011-2022 走看看