justdjango / getting-started-with-django

A beginners course for Django
MIT License
352 stars 249 forks source link

Missing styles.css after building styles with modern django-tailwind package (v3.1.1) #22

Open paulrogov opened 2 years ago

paulrogov commented 2 years ago

The current version of django-tailwind (3.1.1) package builds styles.css into this folder:

theme/static/css/dist/styles.css

The previous version used in the video (Intermediate Django - Lesson 19.TailwindCSS Improvements) builds into this one:

theme/static/css/styles.css

So, after deploying it into production you'll get such an error (fullscreen):

And Server Error (500) on the prod.

Solution: Fix a link to styles.css inside templates/base.html to be this:

<link  href="{% static 'css/dist/styles.css' %}" rel="stylesheet">

p.s. I also had theme/static/css/dist/styles.css missing from a corresponding git commit at first, because it had turned out to be ignored by .gitignore.

The solution: Add line !/theme/static/css/dist to .gitignore