Ich benutze django 1.10.3 Ich möchte HTML-Vorlage von app dir Ich schaffe App test_page mit Ordnervorlagen und testPage.htmlDjango HTML-Vorlage aus Anwendungsverzeichnis verwenden
In view.py
from django.shortcuts import render
def page(request):
return render(request, 'test_page/testPage.html', locals())
verwenden
In settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, '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',
],
},
},
]
Aber es funktioniert nicht. Wie kann ich HTML-Vorlage von dir-Anwendung verwenden?
Und Ihre Frage? – MooingRawr
Wie kann ich HTML-Vorlage von dir-Anwendung verwenden? –