jinja2 - Django not looking in the correct place for jinja templates? -
i following thread here... how use jinja2 templating engine in django 1.8
i can't seem find solid docs on switching jinja2 templates , how setup django it. docs seem have gaps, or missing somehting obvious. anyway, set thread above, except when try go somewhere template loaded get...
templatedoesnotexist django tried loading these templates, in order: ...
but not list of jinja/ template directories specified. why be?
edit adding trace , settings:
templates = ( { 'backend': 'askbot.skins.template_backends.askbotskintemplates', }, { 'backend': 'django.template.backends.jinja2.jinja2', 'dirs': [os.path.join(project_root, 'templates/jinja2')], 'app_dirs': true, 'options': {'environment': 'myproject.jinja-import.environment',}, }, { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [ os.path.join(project_root, 'templates',), ], 'app_dirs': true, 'options': { 'context_processors': [ 'django.core.context_processors.request', 'django.contrib.auth.context_processors.auth', ] } }, ) traceback: file "/home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django-1.8.8-py2.7.egg/django/core/handlers/base.py" in get_response 132. response = wrapped_callback(request, *callback_args, **callback_kwargs) file "/home/jeff/django/langalang-askbot/langalang/main/views.py" in page 71. context_instance=requestcontext(request, context)) file "/home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django-1.8.8-py2.7.egg/django/shortcuts.py" in render 89. using=using) file "/home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django-1.8.8-py2.7.egg/django/template/loader.py" in render_to_string 137. raise templatedoesnotexist(template_name) exception type: templatedoesnotexist @ /ko/ exception value: main/page.html template loader error: django tried loading these templates, in order: using loader django.template.loaders.filesystem.loader: /home/jeff/django/langalang-askbot/langalang/templates/main/page.html (file not exist) using loader django.template.loaders.app_directories.loader: /home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django-1.8.8-py2.7.egg/django/contrib/auth/templates/main/page.html (file not exist) /home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django-1.8.8-py2.7.egg/django/contrib/admin/templates/main/page.html (file not exist) /home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django-1.8.8-py2.7.egg/django/contrib/sitemaps/templates/main/page.html (file not exist) /home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django_compressor-1.5-py2.7.egg/compressor/templates/main/page.html (file not exist) /home/jeff/django/langalang-askbot/langalang/askbot-dev/askbot/templates/main/page.html (file not exist) /home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django_robots-1.1-py2.7.egg/robots/templates/main/page.html (file not exist) /home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django_celery-3.1.17-py2.7.egg/djcelery/templates/main/page.html (file not exist) /home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django_tinymce-1.5.3-py2.7.egg/tinymce/templates/main/page.html (file not exist) /home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django_recaptcha-1.0.5-py2.7.egg/captcha/templates/main/page.html (file not exist) /home/jeff/django/langalang-askbot/venv/local/lib/python2.7/site-packages/django_avatar-2.2.1-py2.7.egg/avatar/templates/main/page.html (file not exist)
view loading template:
def page(request, page_title='home'): context = { 'page_title': page_title } if page_title == 'home': #this query pulls language instructions objects , orders alphabetically 'full_title' field language_pairs = langpairinstruction.objects.filter(active=true).order_by('full_title') context['language_pairs'] = language_pairs elif page_title == 'contact': form_class = contactform(initial={'subject': _('subject'), 'name': _('name'), 'email': _('email'), 'content': _('content')}) context['contactform'] = form_class elif page_title == 'about': pass else: raise http404 return render( request, 'main/page.html', context_instance=requestcontext(request, context))
Comments
Post a Comment