DEV Community

Django with Tailwind (JIT) and Hot Reloading

praveen on April 21, 2021

I was trying to set up the latest Tailwind (JIT) option for my latest Django project. Thanks to the Django-Tailwind package from Tim Kamanin, in le...
Collapse
 
swdevbali profile image
Eko Suprapto Wibowo

Woa, thank you for this! I was about to gave up after reading this: weautomate.org/articles/using-vite...

I really dislike heavy configuration before doing any real work!
Let me try this and report it after. Looks good!

Collapse
 
swdevbali profile image
Eko Suprapto Wibowo • Edited

Hm, I run this in a docker environment, all setup, but I can't seems to activate the hot reload. Attached is console output of python manage.py tailwind start

I need to manually reload the browser for the changes tho.

Collapse
 
aspraveen profile image
praveen

Hi , This setup worked fine for me, but not on Docker .

I think you can do this on Docker by exposing the hot reloading port some thing like

ports:

  • "10000:10000" ( exact port you need to find)

I was able to fix the hot reloading in a sapper project as mentioned above

Thread Thread
 
swdevbali profile image
Eko Suprapto Wibowo

Right. Wasn't thinking that will be the case. Okay, checking that.

Thread Thread
 
swdevbali profile image
Eko Suprapto Wibowo

Well, it seems like it's not that trivial with docker: I found an open issue here: github.com/timonweb/django-tailwin...

Collapse
 
henriqueccapozzi profile image
Henrique Caricatti Capozzi

First of all, thanks for the post and I'll try it out this week

Second, regarding the hot reloading on docker, if it's a network port issue, perhaps running the container with
docker run .... --network=host ...

might work as soon as i can try I'll update it

@swdevbali

Collapse
 
jnutterdev profile image
John

Thanks so much for this article. Super helpful and easy. :)