argparse.ArgumentError:参数 --skip-checks:

我正在使用 django-tenant-schemas,当我尝试使用“migrate_schemas”命令时遇到错误。我在这里看到过类似的问题,但它们根本没有帮助。我在两个不同的应用程序上尝试过,但结果是相同的。有人知道如何解决这个问题吗?


    Traceback (most recent call last):

  File "C:\DjangoNew\tenancy\manage.py", line 22, in <module>

    main()

  File "C:\DjangoNew\tenancy\manage.py", line 18, in main

    execute_from_command_line(sys.argv)

  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line

    utility.execute()

  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py", line 395, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 322, in run_from_argv

    parser = self.create_parser(argv[0], argv[1])

  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 296, in create_parser

    self.add_arguments(parser)

  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\site-packages\tenant_schemas\management\commands\migrate_schemas.py", line 20, in add_arguments

    command.add_arguments(parser)

  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\migrate.py", line 28, in add_arguments

    help='Skip system checks.',

  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1373, in add_argument

    return self._add_action(action)

  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1736, in _add_action

    self._optionals._add_action(action)

  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1577, in _add_action

    action = super(_ArgumentGroup, self)._add_action(action)



汪汪一只猫
浏览 83回答 2
2回答

喵喵时光机

这是 中的一个错误django-tenant-schemas。从阅读 Django 文档来看,他们似乎忘记设置requires_system_checks为False.在合并此修复之前,您可以Django通过运行以下命令降级到版本 2 来解决此问题pip install "Django~=2.2"或将列表移至tenant-schemas文件INSTALLED_APPS底部settings.py。

墨色风雨

错误:argparse.ArgumentError: argument --email: conflicting option string: --email如果有人遇到 django-rest-framework 的此错误因此,出现此错误是因为字段“电子邮件”是必需的,但仍在模型的REQUIRED_FIELDS列表中。只需将其从REQUIRED_FIELDS中删除,它就应该可以工作。这种情况在其他属性中也可能发生。class UserAccount(AbstractUser):&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; first_name = ...&nbsp; &nbsp; last_name = ...&nbsp; &nbsp; email = models.EmailField(_("Email address"), unique=True, blank=False)&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; REQUIRED_FIELDS = AbstractUser.REQUIRED_FIELDS + ['first_name', 'last_name', 'email']&nbsp; &nbsp; class Meta(AbstractUser.Meta):&nbsp; &nbsp; &nbsp; &nbsp; swappable = "AUTH_USER_MODEL"&nbsp; &nbsp; &nbsp; &nbsp; verbose_name = _("UserAccount")&nbsp; &nbsp; &nbsp; &nbsp; verbose_name_plural = _("UserAccounts")
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python