[Python-apps-team] Bug#893157: planet-venus: django.template.exceptions.TemplateDoesNotExist

beuc at debian.org beuc at debian.org
Fri Mar 16 22:47:41 UTC 2018


Package: planet-venus
Version: 0~git9de2109-4
Tags: patch

Hi,

When processing a .dj template with planet-venus under Debian 9.4/Stretch, I got:
 DEBUG:planet.runner:Processing template /var/www/planet.gnu.org/git/debian/templates/index.html.dj using dj
Traceback (most recent call last):
  File "./code/venus/planet.py", line 158, in <module>
    splice.apply(doc.toxml('utf-8'))
  File "/usr/lib/python2.7/dist-packages/planet/splice.py", line 142, in apply
    output_file = shell.run(template_file, doc)
  File "/usr/lib/python2.7/dist-packages/planet/shell/__init__.py", line 66, in run
    module.run(template_resolved, doc, output_file, options)
  File "/usr/lib/python2.7/dist-packages/planet/shell/dj.py", line 41, in run
    t = get_template(script)
  File "/usr/lib/python2.7/dist-packages/django/template/loader.py", line 25, in get_template
    raise TemplateDoesNotExist(template_name, chain=chain)
django.template.exceptions.TemplateDoesNotExist: /var/www/planet.gnu.org/git/debian/templates/index.html.dj

AFAICS this is related to:
https://docs.djangoproject.com/fr/1.10/ref/templates/upgrading/

The attached patch applies that documentation and fixes the issue:
--- dj.py~	2018-03-16 20:34:34.019196399 +0000
+++ dj.py	2018-03-16 22:37:35.015027892 +0000
@@ -23,7 +23,24 @@
     try:
         settings.configure(
             DEBUG=True, TEMPLATE_DEBUG=True, 
-            TEMPLATE_DIRS=(os.path.dirname(script),)
+            TEMPLATES = [
+                {
+                    'BACKEND': 'django.template.backends.django.DjangoTemplates',
+                    'DIRS': (os.path.dirname(script),),
+                    'APP_DIRS': True,
+                    'OPTIONS': {
+                        'context_processors': [
+                            'django.contrib.auth.context_processors.auth',
+                            'django.template.context_processors.debug',
+                            'django.template.context_processors.i18n',
+                            'django.template.context_processors.media',
+                            'django.template.context_processors.static',
+                            'django.template.context_processors.tz',
+                            'django.contrib.messages.context_processors.messages',
+                        ],
+                    },
+                },
+            ]
             )
     except RuntimeError:
         pass


Works for me.

Cheers!
Sylvain

-------------- next part --------------
A non-text attachment was scrubbed...
Name: planet-venus-dj.patch
Type: text/x-patch
Size: 1224 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/python-apps-team/attachments/20180316/75175144/attachment.bin>


More information about the Python-apps-team mailing list