gpt4 book ai didi

django - 属性错误: 'module' object has no attribute 'lru_cache'

转载 作者:行者123 更新时间:2023-12-02 09:20:59 24 4
gpt4 key购买 nike

在此环境设置中,我收到了如标题所示的错误。Apache2 与 mod_wsgi ,Python 3.5,Django 2.0.2 。我正在使用 virtualevn。

我的虚拟环境位于:/home/santosh/Documents/project/project/django 应用程序位于/home/santosh/Documents/project/Reports

下面是wsgi.py文件的内容

import os, sys


sys.path.append('/home/santosh/Documents/project/Reports/Reports')
sys.path.append('/home/santosh/Documents/project/Reports')


sys.path.append('/home/santosh/Documents/project/project/lib/python3.5/site-packages')
sys.path.append('/home/santosh/Documents/project/project/lib/python3.5')
sys.path.append('/home/santosh/Documents/project/project/bin')



from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Reports.settings")

application = get_wsgi_application()

堆栈跟踪:

[Sun Feb 04 20:40:39.396427 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] mod_wsgi (pid=6428): Target WSGI script '/home/santosh/Documents/project/Reports/Reports/wsgi.py' cannot be loaded as Python module.

[Sun Feb 04 20:40:39.398284 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] mod_wsgi (pid=6428): Exception occurred processing WSGI script '/home/santosh/Documents/project/Reports/Reports/wsgi.py'.

[Sun Feb 04 20:40:39.398425 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] Traceback (most recent call last):

[Sun Feb 04 20:40:39.398475 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] File "/home/santosh/Documents/project/Reports/Reports/wsgi.py", line 30, in

[Sun Feb 04 20:40:39.398555 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] from django.core.wsgi import get_wsgi_application

[Sun Feb 04 20:40:39.398565 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] File "/home/santosh/Documents/project/project/lib/python3.5/site-packages/django/init.py", line 1, in

[Sun Feb 04 20:40:39.398591 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] from django.utils.version import get_version

[Sun Feb 04 20:40:39.398598 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] File "/home/santosh/Documents/project/project/lib/python3.5/site-packages/django/utils/version.py", line 61, in

[Sun Feb 04 20:40:39.398628 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] @functools.lru_cache()

[Sun Feb 04 20:40:39.398643 2018] [wsgi:error] [pid 6428:tid 140043928524544] [client 127.0.0.1:60276] AttributeError: 'module' object has no attribute 'lru_cache'

最佳答案

我跑了

sudo apt remove  libapache2-mod-wsgi
sudo apt install libapache2-mod-wsgi-py3

在Ubuntu 18.04上安装Python3版本,然后重新加载Apache,这为我解决了错误。

关于django - 属性错误: 'module' object has no attribute 'lru_cache' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48609614/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com