timonweb / django-tailwind

Django + Tailwind CSS = 💚
https://django-tailwind.readthedocs.io
MIT License
1.47k stars 92 forks source link

"tailwind init" does not respect dotted app names. #47

Closed nerdoc closed 3 years ago

nerdoc commented 3 years ago

when starting an app usign ./manage.py tailwind init foo - it works flawlessly. Django says that it sort of "recommends" top level directory apps. But the directory structure of bigger projects could be more complicated. Apps are normal python packages which could be installed in any directory, e.g. in one of my projects under the plugins/ directory.

But calling ./manage.py tailwind init plugins.foo tells me that

CommandError: 'plugins.foo' is not a valid app name. Please make sure the name is a valid identifier.

According to the Django docs for AppConfig.name, it is a "full Python path to the application, e.g. 'django.contrib.admin'."

Only the label must be a single Python identifier. So I think django-tailwind mixes up these two (I too did this in a similar library) - could you correct this?

If I create a tailwind app with tailwind init, and copy the static_src folder + base template manually into another app, or move that whole app directory a level deeper, and set TAILWIND_APP_NAME="plugins.foo - it does work, and I can use tailwind install.

timonweb commented 3 years ago

Hi thanks for the report. Feel free to fix the issue and push the PR here, I'll happily merge.

nerdoc commented 3 years ago

I'll try my best ;-)

nerdoc commented 3 years ago

Sorry, I didn't find the time and moved away to django-sockpuppet...