Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'module' object has no attribute 'lru_cache'

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()
like image 539
Aleksey Titov Avatar asked Jul 26 '18 15:07

Aleksey Titov


1 Answers

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

like image 70
Prashant Avatar answered Nov 06 '22 17:11

Prashant