推荐学习书目
› 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 · Jun 26, 2019 · 2740 views
    This topic created in 2674 days ago, the information mentioned may be changed or developed.

    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 replies  •  2019-06-27 10:50:49 +08:00
    ruandao
        1
    ruandao  
       Jun 26, 2019
    嗯
    ruandao
        2
    ruandao  
       Jun 26, 2019
    嗯
    leishi1313
        3
    leishi1313  
       Jun 27, 2019 via Android
    嗯
    haoji
        4
    haoji  
       Jun 27, 2019 via iPhone
    对
    izoabr
        5
    izoabr  
       Jun 27, 2019
    是
    wizardoz
        6
    wizardoz  
       Jun 27, 2019
    嗯
    niknik
        7
    niknik  
       Jun 27, 2019
    嗯
    metamask
        8
    metamask  
       Jun 27, 2019   ❤️ 2
    make / migrations
    顾名思义,就是你说的几点;

    实现的话,可以看下这 2 个文件
    django/db/migrations/autodetector.py
    django/db/migrations/writer.py
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3202 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 14:24 · PVG 22:24 · LAX 07:24 · JFK 10:24
    ♥ Do have faith in what you're doing.