什么是“迁移Django应用程序”?意思? [英] What does "Migrating a Django application" mean?

查看:136
本文介绍了什么是“迁移Django应用程序”?意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近几天,我一直在思考迁移Django应用的含义,并听说过使用 django-south 。也许仅仅是缺乏足够的英语技能(因为英语不是我的母语),或者这是您在程序员生活中面对的事情之一,它是如此简单,以至于需要一个天才才能理解它们(一开始)。 / p>

我已经阅读了我的母语 migrate的翻译,在Wikipedia上阅读了 migration 的定义,阅读django-south的想法,引用:


使用South进行安装,然后
给您的一个或多个应用程序一些
的迁移(要么由
手写) ,或根据您的
模型定义自动生成它们)。当您同步数据库时,
只会同步没有
迁移的应用程序(例如
django.contrib.auth之类的东西,例如具有固定架构的
) ,然后在运行./manage.py migration时进行
迁移,则
South开始介入并进行
迁移。


这令人困惑,我仍然不理解 django应用程序的迁移或一般的迁移背后的全部内容。我想知道我是否会解释 migration



,我希望。



对我有耐心,但我真的很想知道。所以也许你们中的一个可以解释一下我。



谢谢您的时间。

解决方案

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



syncdb 内置于Django的命令无法自动为您更改模式,而无需先删除所有内容,这就是为什么出现诸如South和移民之类的问题。



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



来自移民页面


有了移民,您的$的每次更改b $ b数据库(包括创建初始表的
)捆绑在
a迁移中。迁移是位于
迁移目录中的Python
文件。可以依次应用它们和不应用(恢复)



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.

解决方案

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.

这篇关于什么是“迁移Django应用程序”?意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆