当前位置:  开发笔记 > 编程语言 > 正文

Django Taggit - AttributeError:无法设置属性

如何解决《DjangoTaggit-AttributeError:无法设置属性》经验,为你挑选了1个好方法。

昨天我安装PostgreSQL作为我正在开发的网站的数据库.安装后,计算机重新启动.

怎么了?我丢失了所有环境变量(我正在使用Windows 10).所以我不得不重新添加python到路径.

之后,我创建了db,我替换了settings.py上的数据.我运行网站,但它给出了一个错误.所以我安装了psycopg2让postgres使用django.没门.

我决定暂时回到sqlite3,所以我编辑了settings.py并运行了网站.错误告诉我没有名为Taggit的应用程序.(???)这不正常.我安装了它,一切正常.我重新安装了它(版本0.17.1).

我不知道如果这些事件是连通的...这就是我告诉你一切的原因.现在:在我使用django Taggit的每一个项目中,我都会收到同样的错误(即使是我几个月没打开的那个)...

Unhandled exception in thread started by .wrapper at 0x00000181AA17DAE8>
Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "C:\Python35\lib\site-packages\django\core\management\commands\runserver.py", line 113, in inner_run
    autoreload.raise_last_exception()
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_exception
    six.reraise(*_exception)
  File "C:\Python35\lib\site-packages\django\utils\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "C:\Python35\lib\site-packages\django\__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Python35\lib\site-packages\django\apps\registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "C:\Python35\lib\site-packages\django\apps\config.py", line 199, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 986, in _gcd_import
  File "", line 969, in _find_and_load
  File "", line 958, in _find_and_load_unlocked
  File "", line 673, in _load_unlocked
  File "", line 665, in exec_module
  File "", line 222, in _call_with_frames_removed
  File "C:\Users\Marco\Documents\Progetti\GiemmeLift\website\blog\models.py", line 21, in 
    class Post(models.Model):
  File "C:\Users\Marco\Documents\Progetti\GiemmeLift\website\blog\models.py", line 34, in Post
    tags = TaggableManager()
  File "C:\Python35\lib\site-packages\taggit\managers.py", line 285, in __init__
    rel = TaggableRel(self, related_name, self.through, to=to)
  File "C:\Python35\lib\site-packages\taggit\managers.py", line 55, in __init__
    self.to = to
AttributeError: can't set attribute

我试图重新安装django-taggit但没有改变.

你能帮我理解为什么吗?



1> 小智..:

我有同样的问题,安装了最新版本的django-taggit并且它有效.

推荐阅读
重庆制造漫画社
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有