使用django-cms管理环境中的数据

时间:2021-07-14 08:51:15

I have a Django site running django-cms, and three environments: local dev (currently a sqlite DB that's committed to the repo), staging (mysql), and prod (mysql). There are other django apps in the project that have their own tables in the DB(s), and schema changes are managed through South migrations.

我有一个运行Django -cms的Django站点,以及三个环境:本地开发(目前是一个提交给repo的sqlite DB)、登台(mysql)和prod (mysql)。项目中还有其他django应用程序,它们在DB(s)中有自己的表,模式更改通过南部迁移进行管理。

We do development using a "git flow" process, meaning that features are developed in branches and merged into a "develop" branch when complete. From a deployment standpoint, the develop branch maps to the staging version of the website.

我们使用“git流”过程进行开发,这意味着在分支中开发特性,并在完成时合并到“development”分支。从部署的角度来看,开发分支映射到站点的登台版本。

I'd like a way to manage data in these environments that doesn't involve manually crafting data migrations for django-cms, or blowing away the staging/prod databases to loaddata in changes.

我想要一种在这些环境中管理数据的方法,不需要为django-cms手工处理数据迁移,也不需要在更改中删除staging/prod数据库以加载数据。

What's a good working strategy for this? Is there a quasi-automated way to generate South data migrations? Or a way to have django-cms publish pages to different environments?

有什么好的工作策略?是否有一种准自动化的方法来生成南方数据迁移?或者让django-cms发布页面到不同的环境?

1 个解决方案

#1


1  

I run the exact same setup on multiple projects but almost never look to migrate data between dev, stage or production.

我在多个项目上运行了完全相同的设置,但几乎从不考虑在开发、阶段或生产之间迁移数据。

Development environments get messy with test data, stage environments get messy with development code and data which doesn't make it to production. Meaning that hopefully production stays clean and tidy.

开发环境由于测试数据而变得混乱,阶段环境由于开发代码和数据而变得混乱,而这些代码和数据并不能使其投入生产。意思是希望生产保持干净和整洁。

Following on from this moving data between them should be done carefully and I'd almost never look to automate this in case of erroneous data making it to the production database.

在它们之间跟踪移动的数据应该小心地进行,如果错误的数据进入生产数据库,我几乎不会考虑自动化。

If there is important information which you put in to your staging environment to demo to a client or perform 'final' testing on before deploying to production then I'd suggest performing a data migration with south on that specific app and deploying with that data migration.

如果在部署到生产环境之前有重要的信息需要提交到登台环境中向客户端进行演示,或者执行“最终”测试,那么我建议在特定的应用程序上与south进行数据迁移,并在数据迁移时进行部署。

For any other types of data migration, like CMS page setup etc, I'd recommend setting things up in CMS draft mode as you need them, them publishing.

对于任何其他类型的数据迁移,如CMS页面设置等,我建议您根据需要将内容设置为CMS草稿模式,然后发布。

#1


1  

I run the exact same setup on multiple projects but almost never look to migrate data between dev, stage or production.

我在多个项目上运行了完全相同的设置,但几乎从不考虑在开发、阶段或生产之间迁移数据。

Development environments get messy with test data, stage environments get messy with development code and data which doesn't make it to production. Meaning that hopefully production stays clean and tidy.

开发环境由于测试数据而变得混乱,阶段环境由于开发代码和数据而变得混乱,而这些代码和数据并不能使其投入生产。意思是希望生产保持干净和整洁。

Following on from this moving data between them should be done carefully and I'd almost never look to automate this in case of erroneous data making it to the production database.

在它们之间跟踪移动的数据应该小心地进行,如果错误的数据进入生产数据库,我几乎不会考虑自动化。

If there is important information which you put in to your staging environment to demo to a client or perform 'final' testing on before deploying to production then I'd suggest performing a data migration with south on that specific app and deploying with that data migration.

如果在部署到生产环境之前有重要的信息需要提交到登台环境中向客户端进行演示,或者执行“最终”测试,那么我建议在特定的应用程序上与south进行数据迁移,并在数据迁移时进行部署。

For any other types of data migration, like CMS page setup etc, I'd recommend setting things up in CMS draft mode as you need them, them publishing.

对于任何其他类型的数据迁移,如CMS页面设置等,我建议您根据需要将内容设置为CMS草稿模式,然后发布。