V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
sailorlisa
V2EX  ›  Python

Python Django 中对于 makemigrations 命令的疑问

  •  
  •   sailorlisa · 2019-06-26 18:32:20 +08:00 · 2018 次点击
    这是一个创建于 1769 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Question

    在整理自己学习笔记《 python 编程 从入门到实践》的时候...补充了自己对这个命令的解释,请问是否正确?

    如有误,请帮忙指出!非常谢谢!

    Detail

    (ll_env) learning_log $ python manage.py makemigrations learning_logs
    
    Migrations for 'learning_logs':
    	0001_initial.py:
      	- Create model Topic
    
    • 运行命令后,Django 会检测你对模型文件的修改
    • 之后把修改的内容储存为迁移文件
    • 查看文件夹我们可以看到,出现了 1 个迁移文件( 0001_initial.py ),这个 py 文件创建了 1 个数据库表,这个表用来存储与 模型 Topic 有关的信息(文本、创建时间)
    8 条回复    2019-06-27 10:50:49 +08:00
    ruandao
        1
    ruandao  
       2019-06-26 23:05:48 +08:00
    ruandao
        2
    ruandao  
       2019-06-26 23:05:48 +08:00
    leishi1313
        3
    leishi1313  
       2019-06-27 03:05:14 +08:00 via Android
    haoji
        4
    haoji  
       2019-06-27 07:22:37 +08:00 via iPhone
    izoabr
        5
    izoabr  
       2019-06-27 08:07:15 +08:00
    wizardoz
        6
    wizardoz  
       2019-06-27 09:04:39 +08:00
    niknik
        7
    niknik  
       2019-06-27 10:01:13 +08:00
    freakxx
        8
    freakxx  
       2019-06-27 10:50:49 +08:00   ❤️ 2
    make / migrations
    顾名思义,就是你说的几点;

    实现的话,可以看下这 2 个文件
    django/db/migrations/autodetector.py
    django/db/migrations/writer.py
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3138 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 00:38 · PVG 08:38 · LAX 17:38 · JFK 20:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.