2

我有一个 django 应用程序,django-zinnia-blog用于我的博客功能。

问题一

现在我更新zinnia了最新github版本,我收到了以下奇怪的错误

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 version -- 1.5.3

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

问题二

下面是我的specs/setings

设置.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 version -- 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模型?

并使百日草正常工作?

4

2 回答 2

2

我遇到了同样的问题,我发现将百日草版本更改为 0.14.3 的问题

Zinnia 0.15 仅适用于 django 1.7

请改用 v0.14.3。

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

于 2015-02-09T10:18:31.637 回答
0

我也遇到过这个问题。我能够修复它的方法是链接回原始 zinnia 包中的 model_bases 文件夹。在我网站的“zinnia”文件夹中(存储更新的南迁移):

$ ln -sf <python-path>/lib/python2.7/site-packages/zinnia/models_bases .
于 2014-11-29T17:05:00.687 回答