gpt4 book ai didi

python - django.contrib.comments.moderation.AlreadyModerated 百日草 django 中的错误

转载 作者:太空宇宙 更新时间:2023-11-04 03:55:36 25 4
gpt4 key购买 nike

我有一个 Django 应用程序,我在其中使用 django-zinnia-blog 来实现我的博客功能。

第一期

现在我用最新的 github 版本更新了 zinnia 并且出现了以下奇怪的错误

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x941554c>>
Traceback (most recent call last):
File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run
self.validate(display_num_errors=True)
File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/core/management/base.py", line 280, in validate
num_errors = get_validation_errors(s, app)
File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/db/models/loading.py", line 166, in get_app_errors
self._populate()
File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/db/models/loading.py", line 72, in _populate
self.load_app(app_name, True)
File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/db/models/loading.py", line 96, in load_app
models = import_module('.models', app_name)
File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/user/name/virtualenvironment/apps/proname/proname/apps/zinnia/models/__init__.py", line 19, in <module>
moderator.register(Entry, EntryCommentModerator)
File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/contrib/comments/moderation.py", line 305, in register
raise AlreadyModerated("The model '%s' is already being moderated" % model._meta.module_name)
django.contrib.comments.moderation.AlreadyModerated: The model 'entry' is already being moderated

django 版本 -- 1.5.3

那么为什么在尝试更新 zinnia witj 最新版本时显示 AlreadyModerated 错误?

问题二

下面是我的规范/设置

settings.py

ZINNIA_ENTRY_BASE_MODEL = 'proname.apps.app_name.models.EntryBase'
ZINNIA_SAVE_PING_DIRECTORIES = False
ZINNIA_PING_EXTERNAL_URLS = False

实际上我正在尝试如下扩展 Entry 模型

from zinnia.models_bases.entry import AbstractEntry

class EntryBase(AbstractEntry):
pass

class Meta(AbstractEntry.Meta):
abstract = True
verbose_name_plural = _("Entry")
verbose_name_plural = _("Entries")

def __unicode__(self):
return u'Entry %s' % self.title

django 版本 -- 1.4.5

当我使用以上版本的 django 时,出现了一个额外的错误

raise ImproperlyConfigured('%s cannot be imported' % model_path)

django.core.exceptions.ImproperlyConfigured: zinnia.models_bases.entry.AbstractEntry cannot be imported

所以任何人都可以让我知道如何解决上述问题

AlreadyModerated 更新到最新的 github zinnia 代码时

试图扩展 Entry 模型?

并使百日草正常工作?

最佳答案

我有同样的问题,我想出了将 zinnia 版本更改为 0.14.3 的问题

Zinnia 0.15 only works with django 1.7

Use v0.14.3 instead.

(https://github.com/Fantomas42/django-blog-zinnia/issues/388)

关于python - django.contrib.comments.moderation.AlreadyModerated 百日草 django 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18735480/

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