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

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

问题描述

最近几天我一直在思考迁移 Django 应用程序 的含义,并听说使用 django-south.也许只是缺乏足够的英语技能(因为英语不是我的母语),或者这是你在程序员生活中遇到的事情之一,它是如此简单,以至于需要天才才能理解它们(起初).

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).

我已经阅读了迁移"的母语翻译,阅读了 Wikipedia 上的 migration 定义并阅读了 "the idea" of django-south,引用:

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:

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

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.

这令人困惑,我仍然不明白django 应用程序迁移"或一般迁移"背后的全部内容.如果我知道如何解释 migration

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

我希望你明白了.

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

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.

推荐答案

说到 South 和 Django,迁移就是指改变数据库架构.

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

Django 内置的 syncdb 命令无法在不先删除所有内容的情况下自动为您更改架构,这就是为什么会出现诸如 South 和 dmigrations 之类的事情的原因.

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.

来自 dmigrations 页面:

有了迁移,你的每一次改变数据库(包括创建您的初始表格)捆绑在迁移.迁移是 Python存在于迁移中的文件目录.它们可以应用和按顺序未应用(还原).

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天全站免登陆