timonweb / django-tailwind

Django + Tailwind CSS = πŸ’š
https://django-tailwind.readthedocs.io
MIT License
1.45k stars 89 forks source link

[BUG] TypeError: handle_init_command() takes 1 positional argument but 2 were given #111

Closed Ambro17 closed 2 years ago

Ambro17 commented 2 years ago

When running python manage.py tailwind init app the comand fails with

TypeError: handle_init_command() takes 1 positional argument but 2 were given

because it passes two arguments to handle_init_command.

I stopped the debugger there and one can see the two options

        getattr(self, "handle_" + labels[0].replace("-", "_") + "_command")(
            *labels[1:],  # ('init', 'app') 
            **options, # {'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'force_color': False, 'skip_checks': False, 'no_sync': False, 'no_jit': False, 'no_input': False, 'app_name': None}
        )

so the following method fails

    def handle_init_command(self, **options):
        ...

Removing the labels argument works and the theme app is created as expected

Is this a recent regression? If i understand the problem correctly, all methods will face the same problem as they only expect self and **kwargs but no positional arguments received by *labels[1:]

Project Layout

.
β”œβ”€β”€ README.md
β”œβ”€β”€ djtail
β”‚   β”œβ”€β”€ djtail
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ asgi.py
β”‚   β”‚   β”œβ”€β”€ settings.py
β”‚   β”‚   β”œβ”€β”€ urls.py
β”‚   β”‚   └── wsgi.py
β”‚   β”œβ”€β”€ manage.py
β”‚   └── tailwind.config.js
β”œβ”€β”€ poetry.lock
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ static
β”‚   └── tailwind.css

Software versions

Python 3.9.7
Django 3.2.9
Django-tailwind 2.2.2

Thank you for the project, let me know if i can add more information or test an alternative branch

roushikk commented 2 years ago

According to the documentation, you need to run python manage.py init (without the app name), and it'll ask you for the app name later. I don't think there's support for passing the app name directly in the manage.py tailwind init command. However, the support can be added with a few tweaks

Ambro17 commented 2 years ago

Oh, i copied the command from a tutorial and assumed it was correct, i will try without it and report back