首先我们需要进入 Django 的 shell

python manage.py shell

渲染模版中的 name

from django.template import Context,Template
t=Template("Hello {{name}}")
c=Context({"name":"klvchen"})
t.render(c)
'Hello klvchen'

Django 命令行调用模版渲染

相关文章:

  • 2021-11-01
  • 2022-02-01
  • 2022-12-23
  • 2022-02-28
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2021-06-10
猜你喜欢
  • 2021-07-17
  • 2021-12-18
  • 2021-05-19
  • 2021-11-19
  • 2022-12-23
  • 2021-05-29
  • 2022-03-01
相关资源
相似解决方案