【发布时间】:2015-04-01 02:44:34
【问题描述】:
app.views.py
from django.shortcuts import render
from django.views.generic import View
class RegisterView(View):
def get(self,request):
return render(request, 'register.html' , { 'title' : 'Register Page'} );
register.html
{% extends 'base.html' }
{% block head}
{{title}}
{% endblock}
{% block content}
Register Page
{% endblock }
base.html
竞技场应用
{% 块头}
主页
{% 端块 }
</title>
</head>
<body>
<h2> Welcome to arena app </h2>
{% block content }
<p>
this is base page
</p>
{% endblock }
</body>
</html>
**问题:**当我访问 http://127.0.0.1:8000/account/register 时,我得到了:
http://i.stack.imgur.com/Y9Lod.png
我的文件结构:
http://i.stack.imgur.com/1KvDP.png
最后我在settings.py 中的TEMPLATE_DIRS var 看起来像:
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)
Django 版本:1.7.3
【问题讨论】:
-
您在所有标签中都缺少
%这样的% }。
标签: python django django-templates django-views