cloudblue / django-cqrs

django-cqrs is an Django application, that implements CQRS data synchronization between several Django micro-services
https://django-cqrs.readthedocs.io/en/latest/
Apache License 2.0
122 stars 24 forks source link

Some strange 'utils' command appears in the --help #75

Closed d3rky closed 2 years ago

d3rky commented 2 years ago

if you try to get --help for django commands with installed django-cqrs the strange 'utils' command is in the list

python manage.py --help
...
[dj_cqrs]
    cqrs_bulk_dump
    cqrs_bulk_load
    cqrs_consume
    cqrs_dead_letters
    cqrs_deleted_diff_master
    cqrs_deleted_diff_replica
    cqrs_deleted_sync_replica
    cqrs_diff_master
    cqrs_diff_replica
    cqrs_diff_sync
    cqrs_sync
    utils
...

But if you try to run it the following error appears:

python manage.py utils --help
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 257, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 40, in load_command_class
    return module.Command()
AttributeError: module 'dj_cqrs.management.commands.utils' has no attribute 'Command'

Looks like the file https://github.com/cloudblue/django-cqrs/blob/master/dj_cqrs/management/commands/utils.py should be moved somewhere out of the /commands folder

qarlosh commented 2 years ago

renaming to _utils.py should exclude it from the command list