python - Django 的迁移列表在哪里 (migrate -l)

标签 python django

我刚刚升级到 Django 1.11.4 而且我不能使用 python manage.py migrate -l

不再有列表选项。为什么?什么是替代品?

该列表是验证尚未迁移的内容的好方法。


来自最新的 Django:

usage: manage.py migrate [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS]
                         [--pythonpath PYTHONPATH] [--traceback] [--no-color]
                         [--noinput] [--database DATABASE] [--fake]
                         [--fake-initial] [--run-syncdb]
                         [app_label] [migration_name]

Updates database schema. Manages both apps with migrations and those without.

positional arguments:
  app_label             App label of an application to synchronize the state.
  migration_name        Database state will be brought to the state after that
                        migration. Use the name "zero" to unapply all
                        migrations.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions
  --no-color            Don't colorize the command output.
  --noinput, --no-input
                        Tells Django to NOT prompt the user for input of any
                        kind.
  --database DATABASE   Nominates a database to synchronize. Defaults to the
                        "default" database.
  --fake                Mark migrations as run without actually running them.
  --fake-initial        Detect if tables already exist and fake-apply initial
                        migrations if so. Make sure that the current database
                        schema matches your initial migration before using
                        this flag. Django will only check for an existing
                        table name.
  --run-syncdb          Creates tables for apps without migrations

最佳答案

Django 1.8 引入了 showmigrations 命令,您可以改用它 (details)。

migrate --list 从 1.8 开始被弃用,并在 1.10 中被移除。

关于python - Django 的迁移列表在哪里 (migrate -l),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45879793/

相关文章:

控制台中的 Python\xYZ 字符

python - 用 Django 过滤

python - 获取多次上传的文件的 Django 生成的唯一名称

通过分组优化 Python 打包

python - 多处理中的共享内存

python - 如何在 Airflow 中使用 EmailOperator 发送多封电子邮件

python - 将 <> 运算符转换为 python3

python - 如何更改我的 Django 服务器时间

python - cloudsql 数据库与 django on 'new' 灵活的谷歌应用引擎

django - Twitter Bootstrap的Django错误样式