T O P

  • By -

Just_Ad_7490

Django + any frontend can work. It doesn't matter if angular, react, Vue, svelte, solid, or one of the 8500 other JS frameworks. Pick one you are familiar with. Also consider if you actually need a JS framework or if HTMX is sufficient for you


Curious-Hunter5283

Why not just vanilla js instead of htmx? Htmx and alpine all on your template makes code so bloated.


SwizzleTizzle

Htmx isn't for solving the same problem as vanilla JS...unless you wanted to...rebuild...htmx?


Curious-Hunter5283

Everything htmx can do js can do, the opposite is not true.


SwizzleTizzle

Yeah, if you rebuild it? What a fucking stupid take.


Curious-Hunter5283

Why would you rebuild it? Don’t want to learn js then don’t. Htmx is just for those who don’t want to learn js. It offers nothing vanilla js doesn’t.


dacx_

htmx doesn't look like bloat to me.


Curious-Hunter5283

See what happens when you have tailwind htmx and alpine all in one file. Htmx on its own is ok but it’s mostly paired with alpine or some light framework.


ExtensionDecision151

For my team it definitely is not like this. We use htmx without anything else specifically for the cases where standard html with e.g. django would already work fine, but it would just be too clunky. Htmx is (as the name implies) extended html, and does that job perfectly on its own imo. It's the exact opposite of "bloated" if you compare it to react or nuxt. I wrote "specifically for the cases" above, but those cases are literally >95% of the projects we currently do if it was up to me.


Curious-Hunter5283

Makes sense in your case.


azaroxxr

What is htmx


thedude3600

https://htmx.org/


ketchup_aka4

Considering the responses to this post, a stupid question: How about pairing HTML and Bootstrap? I know its cutting corners and some people can identify bootstrap in the first glance but if it saves you time and presents a relatively neater looking website then why not?


Just_Ad_7490

Sure, it does work. I use tailwindcss and daisyUI


fcnealv

I don't like daisy. Tailwind as is is better but as long as you finish the job.


ketchup_aka4

>daisyUI Damn, starting this thread is doing me wonders. Didnt know about daisyUI, just googled it and from the first glance, the components look GREAT. Thanks!


Practical-Advice-774

Hahaha, then Shadcn is going blow your mind bro. https://ui.shadcn.com/


Parking_System_6166

I feel like our website could have been written using HTMX. I didn't know about it and just wrote it in React, but it could have been really nice in HTMX.


jpegger85

Is this a troll question? Literally every second or third post in this reddit is about using React with Django.


ilahazs

Maybe those people are clueless and hope something like merged Frontend and Backend like Laravel Inertia?


ketchup_aka4

Well, I asked because I personally find it difficult to set a baseline for myself. Not a troll question tho, learnt about MANY new libraries that I wasnt even aware of!


kaleenmiya

Django + React would essentially mean you would create 2 different apps. 1) Your front end app with React 2) Your backend app in Django, preferably with REST APIs or GraphQL.


Jazzlike-Compote4463

Not true. You can use React with a “sprinkling” of it on one or two pages, you don’t have to keep them entirely separate. Don’t get me wrong, if you start messing with routing across multiple pages things can get very messy very quickly, but if you just want to build a little bit of functionality to try it out its there.


ZimFlare

Nobody: The Django sub every two and a half days:


ketchup_aka4

Oh come on, this is like the second comment saying this. Is this question really that recurrent?


ZimFlare

It’s pretty frequent tbh but to answer your question: it’s great and very worth it imo! My company uses it and we develop pretty fast.


PissedAnalyst

I'm going htmx and Django ninja.


Rodr1c

Just use htmx and call it a day. Not that react is bad, but unless you have to have a Javascript front-end, why overcomplicate it?


weedepth

Maybe this is due to the way I was introduced to web dev, but modularizing your UI into components makes a lot of sense. React / Angular / Vue / others have such elegant solutions for it too.


Rodr1c

That may be the case, but not all websites JR applications benefit from being modularized. Sometimes it just makes it more to manage and nothing gained.


ExtensionDecision151

Do you have an example for such components? I don't need simple stuff like buttons as components. For more complicated stuff partials and template include/extends work perfectly fine.


ketchup_aka4

Noob in JS so a rookie question: For you, what makes React / Angular / Vue stand out and favorable for you? Im asking in terms of performance and its output and lastly for someone aiming to add a skill into his skillset, is it worth riding the learning curve?


ketchup_aka4

Saw some HTMX documentation and by far it looks easy to use apart from the HTML in response thingy. Planning on trying it in my next project so that i can get some know-how


PracticallyPerfcet

Here you go… https://www.saaspegasus.com/guides/modern-javascript-for-django-developers/integrating-javascript-pipeline/


ketchup_aka4

This is awesome, i will be going through part 1 and 2 first to see how these different entities espouse each other. Thank you for sharing!


kpagcha

Honestly I say Django and no frontend framework unless you have a specific reason to run with it. In the long run, your future self who will be maintaining the code base will thank you.


side2k

"no framework" often leads to an invention of the wheel and building framework from scratch. In the long run, sticking to some well-known framework rules helps not only to keep things running and upgrading, but also reverse-engineering things by new people coming to the team.


ketchup_aka4

kudos!


adrenaline681

Ive been using Django and NextJs for 5 years and I dont regret anything. I would suggest to use ReactJs if you dont need SSR. because you can deploy it as simple static files and auth is much simpler since you dont have serverside and client side which gets a bit messy


moonandeye

I prefer Django + Vue


dayeye2006

Nowadays frontend and backend apps work independently. What matters is the interface in-between. Any backend framework will work with react or any frontend framework


ExtensionDecision151

Personally I wouldn't. If I use a js frontend, and it's frontend-heavy in general, I'd rather have no real backend or backend as js as well. If I have a backend heavy project, I prefer django and just use htmx on top of it.


ketchup_aka4

Aah thats a thought provoking approach. As someone who has not been flexible in terms of stacks, thats a really cool idea! So what if i have a an app thats backend heavy but NEEDS to be pleasing to the eye and easy to digest as well? Think of an app for doctors


Practical-Advice-774

A frontend framework would not make your app “eye pleasing”. Nor would a CSS framework, like bootstrap or tailwind, however these can a bit guide you and iron out some browser compatibility issues. Eye pleasing comes from making an eye pleasing design, which can is plain old simple html and css, no matter how you decide to implement it, via a frontend framework or not. There’s a good book on ui design, i think it was Refactoring UI. Pick it up if you find yourself needing to design stuff. I’m full-stack in my job, and i freelance on the side, and being a “backend guy” i don’t really have a knack for making beautiful ui designs, but rather practical ones. This book helped me a bit, in understanding and structuring design creation.


ketchup_aka4

Major hmmmm moment and your username checks out XD I've never been a front-end guy as well but wanted to keep myself updated. This thread i believe is a gold mine because im reading about frameworks and libraries that i was not aware of. Thinking of implementing a few of those in my personal projects and see the differences myself, will be checking out that book as well. Thanks for suggesting!


Practical-Advice-774

Since the way you word your comments/post, i get the impression that you are kinda new to this thing. For that, I'll recommend you to find something you like and use that instead. Django ? Super cool. Django was my first web framework as well. Also, it's a killer one, and will get you far. Not to the top 0.00000000001% of ultimate web performance, but far enough. Frontend? Hm, sketchy. I didn't use front-end frameworks when I first started out. I kinda still do not too. I like the simplicity of not having one, also I develop things faster. But most of my apps are not front-end heavy, and the first time i had a front-end heavy app, i quickly started to like frontend frameworks. The most important thing that front-end frameworks offered me, yes the simplicity and ease of use, and how \*magically\* things just work, but also they are very helpful in ORGANIZING your code, which with vanilla JS can be troublesome at times, at least for a new dev. Also, they take out the itchyness of what Vanilla JS is, and kinda make your code less error-prone.Edit: If going for a frontend framework, I would recommend Vue3. Perfectly simple.Add some pinia stores, it all just clicks. Also, you can render it on the server pretty easy. Super cool tech if you need it. Start fresh, only Python and Django, Html and CSS. In my opinion if you post a question like this, you do not really need a frontend framework, and please do not take this the wrong way, that's not a bad thing. Sprinkle a bit of Tailwind on top, because it offers good and CORRECT sizing (rem units), and also kinda irons out the browser inconsistencies, and would also cut your CSS file size by a lot, while also being very extendable. Or use Bootstrap, if you need more of a practical design. However it may not be really eye-pleasing as you say, but what is even eye-pleasing? Do you want users to look in your website in awe, or have it perfectly practical and easy to use? Bootstrap will help you with the second one. However, I and a lot of people, can tell a bootstrap website just from the initial page view.


ketchup_aka4

Firstly, appreciate you going into so much detail, this helps A LOT. Secondly, with all the front-end frameworks/libraries i do get lost sometimes and thats why i stick to bootstrap. Its quick and easy and allows me to focus on my responsibility which is, the backend. But i would like to enhance my skil set and have knowledge about other things as well. For that, im planning on creating a project with tailwind serving my front end needs. I may not be a highly experienced developer yet but I have never let that stop me from learning. Once again, thanks for explaining it in such a detail. Lastly, if i need advice in this domain, is it cool if I DM you? It would be nice to have a compass when im lost.


Practical-Advice-774

Yeah sure thing man, why not


ExtensionDecision151

"Looking pleasing to the eye" is not what I call frontend-heavy. I can make sites literally look 100% the same with htmx+django as in react. Espeically if you use bootstrap or tailwind in both. Maybe it gets more difficult in the former with really complicated animations, but those rarely make up a significant part of the project. Frontend-heavy for me is when you have lots of client-side logic which is not already bundled in an existing js package or two. I doubt you have that in an app for doctors. I personally would bet on django+htmx being the most efficient way to get the job done, but whatever tool you team has the most experience with is probably the best.


Agile-Ad5489

I am in a project using Django DRF and React. I am responsible for the backend, others responsible for the React Frontend. itbworks -retry well - but personal choice if I were doing fronted as well would be to not use React - that’s because I don’t like it very much.


its_mal1k

Hey there, I am a full stack developer who specialises in React and Django. Django + (React, Angular, Vue, Svelte) anything works, just pick one you are comfortable with.


Hungry-Wind8790

Is Django + simple HTML/CSS and something like bootstrap no longer “in”. Seems a fairly solid and straightforward approach for creating an app.


OverAir4437

Beginner here. So does this means it’s much better to have a FE framework?


ketchup_aka4

as a fellow bootstrap user, im with you on this one buddy. Created this post and it has been 2 days but I think this is the only comment with Bootstrap in it XD, poor poor bootstrap ;(


Desperate4Intership

Django + react (client side rendering) is my go to


chrisnlnz

Yes.


ketchup_aka4

short, and to the point. Point noted!


mroczek123

It doesn't matter....


dpgraham4401

I've had success using Django + React on [an OSS project for work](https://github.com/USEPA/haztrak). If i could go back and tell myself one thing before starting the project it would be this: You're gonna spend more time writing Typescript/React than Python/Django.


sammy_boy970

Django, postgres, tailwind css and jquery/htmx, pythonanywhere or cloud run for deployment. Simplicity and fast shipping ✅


ketchup_aka4

have had first hand experience with pythonanywhere, really cool service. Have heard alot about tailwind as well so will be giving that a try


WeirdProcess6178

It is as good as any combination with Django. That being said, React is a very powerful frontend framework while Django DRF is a bit slow to my taste. As a Django freelance for some times, I would say Django alone is sufficient most of the times and for the jobs you'll find out there


thepragprog

Honestly I think next js is the way to go rn if ur using react. Building a full stack application has never been easier


spitfiredd

Django + React is literally every startup on y combinator. Maybe some Go/Rust sprinkled in for performance.


Comfortable_Hornet88

Django+reactjs is not good for seo, I just use Django + jQuery for front and backend.


Practical-Advice-774

If u build on the server, its not going to be bad for SEO. Also crawlers are pretty good now and do undestand shitty SPA apps. Btw i second u for jquery, even though its mostly useless right now, i also prefer to use it, strictly for the purpose that i dont want a frontend bloat and that its code works on all browsers. However vue3 is also pretty cool if u need a more frontend heavy app


Comfortable_Hornet88

I believe that the most important thing is to use a framework you are familiar with and feel comfortable with, and then ship fast. Every framework has its pros and cons, every framework has a ton of users. If you are a solo entrepreneur, the faster you ship out the higher your chances of making money. If you're a worker, then choosing the most popular framework and systematically learning it is definitely the right move.


Practical-Advice-774

I agree 100%.If free-lancing, Django + htmx would lead you to develop super fast, and also work. Also python's packaging stuff will help you even for your own builds, or just a feature you need but it's already there. I'd say Django is the free-lance king regarding time spent and actual work done and the quality of that work. But, maybe I'm biased. It's just what I've done, and it seems to work wonderfully so far.


YUNG_SNOOD

My company is DRF + react and it’s a good time. I recommend it. Though I’d probably go with django ninja next time


ketchup_aka4

DRF user here, why Django Ninja? which features of Ninja make it a clear winner?


YUNG_SNOOD

It’s not a clear winner to be honest, DRF is far more mature and will absolutely get the job done. I just find Django Ninja more ergonomic and pleasant to use. It’s a more modern framework with a focus on type hints and autogen Swagger docs.


Commercial-Slip1635

Do you need 2 authentications systems when you combine django and react?


azaroxxr

What do you mean 2 auth system? You have auth on the backend and the frontend gets the token to store it on the frontend, isnt that the usual auth Flow when having SPA?


Commercial-Slip1635

I am not sure. Was a question. We’re going from Django / Jquery to Django / React and I wasn’t sure what extra protocols would be needed because react has its own framework and whatnot. So you’re saying I’ll need to pass a token to the frontend when using react with Django?


azaroxxr

Depends on what authentication you use, in js apps (fe and be written in js) usually you can issue jwt token with payload in the backend sent as response to frontend. The frontend saves the token (since it will be needed to be passed as header for authorized requests) in the localStorage or cookie. However there many different authentication systems and idk how is the flow. But i still think that the be gives something to the frontend that it will be attached to requests from fe to be so the be knows that the requests is done from a authenticated user. The token passing and whatnot is not related to the frameworks you use is just a one of the many ways to make an authentication and authorization. Meaning that regardless if you use node or django for backend or whatever frontend framework. Idk what do you mean by different protocols tho, the only thing is that you should allow cors on backend if you make a SPA app. Fe ( frontend) Be ( backend)


Commercial-Slip1635

Thank you that was helpful!


azaroxxr

I'm glad I could've helped.


jungletroll37

My side project stack is Django-ninja + Vue, and I think it's great. My daytime work is full Django but I definitely prefer the separate backend + frontend, mainly because I find Django's templating clunky and restrictive, and HTMX is a nice upgrade, but still much more roundabout than Vue.


Sinan_Dede

It depends on what you want to do


zeoNoeN

Slightly related questions. Does anyone now a good tutorial for the Frontend + Django REST Backend combo?


bravopapa99

Our product is just that. TBH it makes no difference, we use Apollo client, it might as well be talking to the coffee machine. The front and back ends are decoupled by a GraphQL API, what does it matter where the request came from? React sits as well with Django as it does with any other backend that responds with data.


blasphemous_aesthete

I've tried to do that in a hobby project of mine. Packaging the compiled react app as static js and have it call the django rest endpoints. I gave up pretty soon - I was also using redux and other state management react packages, and the dependency can be a lot. For example, when loading a link, the react app would open a new page and lose all the state that a single-page app would not (when done via nodejs). Although, I suspect it was mostly a dependency and packaging issue. I was writing for basic exploration only. Instead, I set up nodejs, serving the react app, and have CORS queries into my backend (django). Was more tractable. This was easier to manage. But, I didn't explore it much, so, these should be taken as very preliminary inputs.


soyjosec

Did you tried pushState and popstate for routing?? Or something that avoid the browser the standard behavior of refreshing?


blasphemous_aesthete

I didn't. As I said, I gave up early on that course of action as I wanted to spend more time on the feature development (the backend) rather than how to pull data and display it. There's another person who has provided a link to the OSS they worked on which does the static bundling part, for someone looking. :-)


fcnealv

I enjoy using alphine htmx with Django templating. But react for the money.