3 ms·
One ideal setup I have is: Django + htmx + templates with jinja2 (to use macros) and styling with tailwindcss The good part is that if you start early with a g
by mariocesar 2y ago
One ideal setup I have is: Django + htmx + templates with jinja2 (to use macros) and styling with tailwindcss
The good part is that if you start early with a good design, it's fairly clear how to move from views to a REST API (DRF or Django-ninja) later and split the front end if you need to.
- dv35z 2y agoThat's interesting - I'll have to explore HTMX and TailWindCSS further - one thing that has held me back is just looking at the HTML source, with all the odd tags, looks messy. I know that's an emotional reaction and not a technical one, but I do appreciate looking at code which just looks clean and neat to me... I've been learning React / Django / Bootstrap (open to ideas on that, but it's just been "there" for me) / SQLite, Postgres / Stripe for payment, Docker, and hosting on AWS and exploring Fly.IO for hosting. I haven't dug into APIs, but curious your thoughts DRF / FastAPI / Django-ninja). I know this is a Rails thread, so there might be a better place to have a discussion about it... Thanks for your insights!
- mariocesar 2y agoFor templating, that is why I prefer Jinja2 with macros instead of Django templates. {% macro IssueCard(issue, type) -%} ... lot of HTML {% endmacro -%} {% for issue in myissues %} {% macro IssueCard(issue, 'myissue') %} {% endfor %} The alternative is creating template tags, which can be a lot of work, and it gets you out of the templates. I have a folder called macros/ where I put all the macros I need, and then I use the import call from Jinja2. I agree with you; having long and deeply nested HTML templates creates too much noise when developing. Jinja2 Macros help with that.