【django】【基礎】templates
1336 ワード
templates
mkdir supporter/templates
vim supporter/templates/index.html
hello django
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'supporter/templates')
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
return render(request=request, template_name='index.html')
return render(request=request, template_name='index.html', context={'hello': 'hello django!!!'})
{{ hello }}