'module' object has no attribute 'lru_cache'
Asked Answered
O

1

5

I'm getting this error in my logs with django app. I thought such errors occur when using Python 2.x, but in my virtual env Python - 3.6.5. Django - 2.0.7. VESTA Control Panel with wsgi. I will be grateful for the help.

Error log:

[Thu Jul 26 19:02:48 2018] [error] [client 86.32.36.143] File "/home/project/private/django/project/env/lib/python3.6/site-packages/django/utils/version.py", line 61, in [Thu Jul 26 19:02:48 2018] [error] [client 86.32.36.143] @functools.lru_cache() [Thu Jul 26 19:02:48 2018] [error] [client 86.32.36.143] AttributeError: 'module' object has no attribute 'lru_cache'

django.wsgi

import os, sys
sys.path.insert(0, '/home/user/web/project/private/django/project/env/lib/python3.6/site-packages')
sys.path.insert(0, '/home/user/web/project/private/django/project/project/src/shared/')
sys.path.insert(0, '/home/user/web/project/private/django/project/project/src/')

os.environ['DJANGO_SETTINGS_MODULE'] = 'main.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Osmose answered 26/7, 2018 at 15:13 Comment(2)
This needs more details to answer. e.g. line number, code.Camelopardus
Add your code and the full error traceback.Valse
S
8

I had the same issue but then found out that my site was built with python3 and apache was configured for python2.7. The following link helped: Target WSGI script cannot be loaded as Python module

Struck answered 28/8, 2018 at 14:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.