推荐学习书目
› 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 · 2786 views
    This topic created in 2705 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
    ruandao
    Jun 26, 2019
    1
    嗯
    ruandao
    ruandao
    Jun 26, 2019
    2
    嗯
    leishi1313
    leishi1313
    Jun 27, 2019 via Android
    3
    嗯
    haoji
    haoji
    Jun 27, 2019 via iPhone
    4
    对
    izoabr
    izoabr
    Jun 27, 2019
    5
    是
    wizardoz
    wizardoz
    Jun 27, 2019
    6
    嗯
    niknik
    niknik
    Jun 27, 2019
    7
    嗯
    metamask
    metamask
    Jun 27, 2019❤️2
    8
    make / migrations
    顾名思义,就是你说的几点;

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