niwinz / django-jinja

Simple and nonobstructive jinja2 integration with Django.
http://niwinz.github.io/django-jinja/latest/
BSD 3-Clause "New" or "Revised" License
363 stars 102 forks source link

Python 2.7: 'module' object has no attribute 'lru_cache' #244

Closed emesik closed 4 years ago

emesik commented 4 years ago

Hi,

Version 2.5.0 crashes on Python 2.7 even though it's described as py2-compatible.

  File "/home/emes/.local/lib/python2.7/site-packages/django_jinja/backend.py", line 114, in <module>
    class Jinja2(BaseEngine):
  File "/home/emes/.local/lib/python2.7/site-packages/django_jinja/backend.py", line 118, in Jinja2
    @functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'

Apparently, functools.lru_cache doesn't exist in py2.

wizpig64 commented 4 years ago

Although release 2.5.0's docs state otherwise, py27 support was indeed removed. 2.6.0 fixes the docs and metadata, but I'm sorry it doesn't fix your problem.

As I'm sure you've heard, Python 2.7 is no longer supported by the python foundation, so my advice to you is to upgrade your project to django 1.11 LTS (assuming you're not already on the last python-2.7 supported django release), and then to python 3.6. Then 2.6.0 should work, and you can proceed to upgrade your project to django 2.2 LTS.

auvipy commented 4 years ago

2.6 has no python 2