您的位置:首页 > 产品设计 > UI/UE

Templates(The Definitive Guild to Django)

2010-03-26 12:50 477 查看
Template:

<html>
<body>It is now {{ current_date }}.</body>
</html>

View:

def current_datetime(request):
now = datetime.datetime.now()
t = get_template('current_datetime.html')
html = t.render(Context({'current_date':now}))
return HttpResponse(html)

Settings:

settings.py TEMPLATE_DIRS = (
'/django/mysite/templates',
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: