python - Django use html template from application directory -
i use django 1.10.3 want use html template app dir create app test_page folder templates , testpage.html
in view.py
from django.shortcuts import render def page(request): return render(request, 'test_page/testpage.html', locals()) 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', ], }, }, ] but doesn't work. how can use html template dir application?
directory structure:
project/ test_page/ templates/ test_page/ test_page.html
Comments
Post a Comment