“迁移 Django 应用程序”是什么意思?意思是?

发布于 2024-08-16 01:11:53 字数 783 浏览 5 评论 0原文

在过去的几天里,我一直在思考迁移 Django 应用程序的意义,并听说了使用 django-南。也许只是缺乏足够的英语技能(因为英语不是我的母语),或者这是你在程序员生活中遇到的事情之一,这些事情非常简单,需要天才才能理解它们(一开始)。

我已经阅读了母语中“迁移”的翻译,阅读了维基百科上迁移的定义,并阅读了django-south 的“想法”,引用:

使用 South,您可以安装它,然后 为您的一个或多个应用程序提供一些 迁移(通过编写它们 手,或者从你的自动生成它们 模型定义)。当你同步数据库时, 您只能同步没有的应用程序 迁移(比如 django.contrib.auth,例如, 有固定的模式),然后 当您运行 ./manage.py migrate 时, 南踢球并做了 迁徙。智能地。

这很令人困惑,我仍然不明白“django 应用程序的迁移”或“一般迁移”背后的全部内容。如果我知道如何解释迁移这个词,我就能理解

我希望你明白这一点。

请耐心等待,但我真的很想知道。所以也许你们中的一位可以解释一下我。

感谢您提前抽出时间。

I kept thinking a lot about the meaning of migrating a Django app the last few days and heard about migrating Django apps with django-south. Maybe it's just the lack of sufficient English skills (as English is not my native language) or this is one of the things you confront in a programmer's life which are so simple, that it takes a genius to understand them (at first).

I've read the translation of 'migrate' in my native language, read the definition of migration on Wikipedia and read "the idea" of django-south, citing:

With South, you install it and then
give one or more of your apps some
migrations (either writing them by
hand, or autogenerating them from your
model definitions). When you syncdb,
you'll only sync apps that don't have
migrations (things like
django.contrib.auth, for example,
which have a fixed schema), and then
when you run ./manage.py migrate,
South kicks in and does the
migrations. Intelligently.

This is confusing and I still don't understand the whole thing behind "migration of django applications" or "migration in general". I'd understand if I'd know how to interpret the word migration

You get the point, I hope.

Have patience with me, but I'd really like to know. So maybe one of you could explain me, please.

Thanks for your time in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白鸥掠海 2024-08-23 01:11:53

当谈到 South 和 Django 时,迁移指的是更改数据库架构。

Django 内置的 syncdb 命令无法在不先删除所有内容的情况下自动为您更改架构,这就是为什么出现了 South 和 dmigrations 之类的东西。

因此,本质上,迁移是一种在保持数据完整的同时更改数据库架构的方法。

dmigrations 页面

随着迁移,您的每一次改变
数据库(包括创建
你的初始表)被捆绑在
一次迁移。迁移是Python
存在于迁移中的文件
目录。它们可以被应用并且
按顺序取消应用(恢复)。

When it comes to talking about South and Django, a migration refers to changing the database schema.

The syncdb command that is built into Django cannot automatically change schema for you without deleting everything first, which is why things like South and dmigrations have come about.

So, essentially a migration is a way to alter your database schema while keeping your data intact.

From the dmigrations page:

With dmigrations, every change to your
database (including the creation of
your initial tables) is bundled up in
a migration. Migrations are Python
files that live in a migrations
directory. They can be applied and
un-applied (reverted) in sequence.

野味少女 2024-08-23 01:11:53

迁移通常是指将应用程序从一个位置移动到另一个位置。这种翻译可以通过物理运动来发生。 (例如从一台服务器移动到另一台服务器),或者作为更合乎逻辑的移动。 (例如从 C# 到 F#)

鉴于仅提到一种技术。它可能主要是一个物理移动应用程序,带有数据库端的轻微逻辑移动。

总结一下应用程序的作用。它可能只是将所有配置和数据导出到文件结构,然后可以将其重新集成到新服务器上的数据库中。

Migrate typically refers to moving an application from one location to another. This translation can happen either via a physical movement. (Such as moving from one server to another), or as a more logical movement. (Such as from C# to F#)

Given that only one technology is mentioned. It is likely primarily a physical movement application with a slight logical movement of the database side.

To summarize what the application does. It likely simply exports all of your configuration and data to a file structure, which can then be reintegrated into your database on the new server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文