argparse.ArgumentError: argument --skip-checks: conflicting option string: --skip-checks

流过昼夜 提交于 2021-01-24 10:50:39

问题


I am working with django-tenant-schemas and when I try to use "migrate_schemas" command I encounter an error. I've seen similar questions here but they didn't help at all. I've tried this on two different apps but the result is the same. Does anybody know how to fix this?

    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)
  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1387, in _add_action
    self._check_conflict(action)
  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1526, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "C:\Users\asyey\AppData\Local\Programs\Python\Python37\lib\argparse.py", line 1535, in _handle_conflict_error
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --skip-checks: conflicting option string: --skip-checks

回答1:


It is a bug in django-tenant-schemas. From reading Django documents it seems like they forgot to set requires_system_checks to False.

I believe this pull request will fix the problem.

Till this fix is merged, you can solve this by either downgrade Django to version 2 by running something like

pip install "Django~=2.2"

or move tenant-schemas at the INSTALLED_APPS list to the bottom in the settings.py file.



来源:https://stackoverflow.com/questions/64233057/argparse-argumenterror-argument-skip-checks-conflicting-option-string-ski

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!