3

Django CMS 应用Aldryn 博客自 2015 年起已弃用,取而代之的是Aldryn 新闻博客

从aldryn-blog 更新到aldryn-newsblog(Django 1.6.11 兼容)的最佳方式是什么?最终目标是能够将我们的 Django 系统从 1.6.1x 更新到 1.7.y

  • 如何将aldryn-blog 条目迁移到aldryn-newsblog?
  • 如何使 aldryn-newsblog 线索与 HTML 兼容?
  • 从 Django 1.6.x 到 Django 1.7.y 以及从aldryn-blog 迁移到aldryn-newsblog 的最佳更新顺序是什么?

我们当前设置的详细信息

要求.txt

--extra-index-url https://divio:wlkdjeorijlerf@pkg.divio.ch/simple/
--extra-index-url https://devpi.divio.ch/divio/all/+simple/
aldryn-apphooks-config==0.2.7
aldryn-blog==0.4.6
aldryn-boilerplates==0.7.4
aldryn-categories==1.0.2
aldryn-common==0.1.4
aldryn-faq==1.0.5
aldryn-gallery==0.2.1
aldryn-newsblog==1.2.1
aldryn-people==1.2.0
aldryn-reversion==1.0.8
aldryn-search==0.2.11
aldryn-translation-tools==0.2.1
argparse==1.2.1
cmsplugin-plaintext-djangocms3==0.2.1
dill==0.2.4
Django==1.6.11
django-admin-sortable==2.0.15
django-admin-sortable2==0.6.3
django-appconf==1.0.2
django-appdata==0.1.5
django-ckeditor==4.4.7
django-classy-tags==0.7.2
django-cms==3.0.15
django-countries==3.3
django-crispy-forms==1.5.1
django-filer==1.2.0
django-haystack==2.4.1
django-hvad==1.5.0
django-meta==0.3.1
django-meta-mixin==0.2.1
django-mptt==0.6.1
django-parler==1.6.2
django-phonenumber-field==1.1.0
django-polymorphic==0.8.1
django-reversion==1.8.4
django-sekizai==0.9.0
Django-Select2==4.3.1
django-sortedm2m==1.0.2
django-spurl==0.6.4
django-standard-form==1.1.4
django-taggit==0.11.2
django-treebeard==4.0
djangocms-admin-style==1.1.0
djangocms-column==1.4
djangocms-file==0.0.2
djangocms-flash==0.0.3
djangocms-googlemap==0.1.0
djangocms-inherit==0.0.2
djangocms-installer==0.5.4
djangocms-link==1.4.0
djangocms-picture==0.0.4
djangocms-snippet==1.5
djangocms-style==1.4
djangocms-teaser==0.0.2
djangocms-text-ckeditor==2.3.0
djangocms-video==0.0.2
factory-boy==2.5.2
fake-factory==0.5.3
html5lib==0.9999999
lockfile==0.10.2
mock==1.3.0
pandas==0.16.2
phonenumbers==7.3.1
phonenumberslite==7.3.1
Pillow==2.5.3
psycopg2==2.6.1
pytz==2014.7
six==1.10.0
South==1.0.2
wsgiref==0.1.2

您的项目中是否覆盖了 Aldryn 博客模板?

是的,但只是表面上。目前,我们确实已经删除了 Aldryn 博客模板,但可以恢复此步骤。如果需要回答我的问题,我很乐意提供这些模板。

您的项目中是否有对 Aldryn 博客的自定义扩展?

不。

博客文章当前是否可搜索?(草垛)

django-haystack已安装,但我们目前没有使用此功能。

您是否在使用 Aldryn 博客提供的任何插件?喜欢作者或标签?

Aldryn 博客文章被标记并有作者,但我们没有使用标签或 BlogAuthors 插件的额外功能。

谢谢!

4

1 回答 1

4

以下是我对您的一些问题的回答:

如何使 aldryn-newsblog 线索与 HTML 兼容?

是的,Aldryn 新闻博客使用 djangocms-text-ckeditor 的HTMLField

如何将aldryn-blog 条目迁移到aldryn-newsblog?

非常小心:) 开玩笑...

首先,进行此迁移的唯一方法是在整个过程中保持在 1.6 上。意思是,在迁移完全完成之前不要升级到 Django >= 1.7。

也就是说,为了向您提供尽可能多的信息,请发布以下软件包的确切版本(或 pip freeze):

  • 姜戈
  • Django CMS
  • django taggit
  • 奥尔德林博客
  • Aldryn 新闻和博客(是否已安装?)
  • Aldryn 类别(是否已安装?)
  • django-hvad
  • djangocms-文本-ckeditor

另外,这里有一些问题:

您的项目中是否覆盖了 Aldryn 博客模板?

您的项目中是否有对 Aldryn 博客的自定义扩展?

博客文章当前是否可搜索?(草垛)

编辑 v1

我进行此类迁移的方式是编写多个 django 管理命令,通常是一个“主”命令,它会调用其他命令。

通过这样做,我可以在本地更快地迭代,并且在准备好(经过大量测试之后)直接在 prod 上运行命令(在升级必要的依赖项之后)。

强烈建议在迁移的本地开发过程中使用stellar进行快速数据库快照。允许您立即快照和恢复数据库,并且非常容易设置。

以下是此类主命令的示例:

from django.core.management import call_command, CommandError
from django.core.management.base import NoArgsCommand
from django.db import connection

from south.db import db

from cms.models import Page


class Command(NoArgsCommand):
    can_import_settings = True

    def handle_noargs(self, **options):
        self.stdout.write("Running migrations.\n")

        # Migrate newsblog up to 0013
        call_command('migrate', 'aldryn_newsblog', '0013')

        # Now fake migration 0014 because we don't want the default
        # app config since we'll create it in a later step
        call_command('migrate', 'aldryn_newsblog', '0014', fake=True)
        # Now migrate all the way to 0027 because we need to fake 0028
        call_command('migrate', 'aldryn_newsblog', '0027')
        # This migration has unfortunate side effects when Aldryn blog
        # is installed in the system.
        # It's ok to fake it because is just a data migration
        call_command('migrate', 'aldryn_newsblog', '0028', fake=True)
        # Move to 0035 because we need to fake 0036
        call_command('migrate', 'aldryn_newsblog', '0035')
        # Because we're not using default apphook config, fake 0036
        call_command('migrate', 'aldryn_newsblog', '0036', fake=True)

        # Proceed with all migrations
        call_command('migrate')

        self.stdout.write('Setting up blog page.\n')
        call_command('setup_blog_page')

        self.stdout.write('Migrating Aldryn Blog to Aldryn News & Blog.\n')
        call_command('migrate_blog_to_newsblog')

现在,您需要setup_blog_pageandmigrate_blog_to_newsblog命令。在提供它们之前,我还有一个问题:

您是否在使用 Aldryn 博客提供的任何插件?喜欢作者或标签?

于 2016-05-09T16:45:50.303 回答