#I don't know what to use with django

30 messages · Page 1 of 1 (latest)

pliant jungle
#

i have tried Vuejs and HTMX but I didn't like them. recently I started using React and I fell in love with that, that is super cool and easy to me.
I'm have using Django for 4 years and I like that really much I want a good front-end for Django instead of pure html CSS or jQuery when I decided to use React with Django I was very happy but when I noticed that Django and react doesn't integrate and something like that I got disappointed
Now what's your **suggestion **to use with Django??

fair hawk
#

They do integrate. It's not super duper easy, but many people have done it.

pliant jungle
hoary oar
#

It's not hard to integrate, it's just that you have to use frontend framework more

#

If you like Django templates, why not just stick with them?

#

I much prefer them overdoing things in JS, and not seeing why most projects would need a full-scale frontend framework

true junco
#

Whenever you use any front-end franework. Django becomes your backend through the use of DRF (Django Rest Framework) that serves APIs where as your Frontend consumes or interacts with API.

FYI only do it when your scaling up with a team that has that skillsets to split ppl to support either frontend or backend.

The other option is the use of Tailwind CSS that interacts with Django along with HTMX. But you still run the problem in tailwind configuration and making them work well together with django.

jagged shuttle
#

I think you have to use inertia

copper zealot
silent jacinth
#

There are several ways of integrating a reactive js frontend framework like React/Vue/Angular with Django. Some are very much separated apps that only talk JSON to each other, others are more hybrid as you may want to still be able to use the Django templating mixed with some pages/"islands" that use the js frontend for improved UX.

https://fractalideas.com/blog/making-react-and-django-play-well-together/

buoyant thicket
# silent jacinth There are several ways of integrating a reactive js frontend framework like Reac...

This pattern only really works well when the components don't interact with the server and are moreso for querying data already on the client than mutating it across client/server boundary. Otherwise you need to set up rest endpoints in addition to normal routes which imo feels more complicated than it needs to be. IMO use Django (with HTMX/JS if desired) or DRF or django-ninja as just the backend and have a seperate client app.

jolly siren
#

I personally recommending building out your API using graphene to make a scalable graphql API.

#

You can use the graphql type generator for typescript and python to share data models without having to rebuild them in each lanhuage, but seriously, it's not even bad if you're doing it manually, because you don't have to worry about poor Django frontend performance and Django-isms.

warm gazelle
#

They do integrate and depends on your project setup.
One of the easiest way is using separate frontend and backend which may have more cost considering the different hosting.

scarlet moth
#

There’s Inertia-Django, based on Inertia.js (from the PHP based Laravel project). But it’s not as complete as the original one used for Laravel.

scarlet moth
jolly siren
near rivet
fervent trout
#

I think that you should make an API with DRF and make the react app consume that API. All other things are hacky and frustrating IMO

true junco
#

Yup having separated FE (any FE framework consuming API calls) & BE (Django serving as backend capabilities include GraphQL and websockets) is still alright since it makes it easier to maintain & scale the codebase.

mossy juniper
#

all my CRUD is manage via htmx : hx-get load the List in a dedicated div. Clicking Add_item open a modal (bootstrap) with the form inside. When I close the modal, htmx reload only the content where List is "included", with a fade-in effect. I use hx-delete to remove item, without reloading nothing. I user Sortables.js to manage some items, in a moal, and htmx make the "backpage" updating alone, without the user living modal or reloading nothing. That a great UX.

vestal arch
fervent trout
#

In this video, you will learn how to use Python and JavaScript to create a full-stack web application. We will be using Django for the backend & React for the frontend as well as implementing authentication using JWT tokens. And as a bonus, I am going to show you how to deploy this application for free.

WSO2 Code Challenge: https://tinyurl.com/...

▶ Play video
#

See this

clever turtle
split token
#

Personally I would rather retain the benefits of Django templates and only use JS where necessary instead of making a REST API and a separate SPA app unless I need to. I'm considering using Inertia.js + Vue or Alpine.js but I also just discovered Unicorn which looks nice due to how closely tied to Django itself it is. https://www.django-unicorn.com/

true junco
#

I won't touch it since more unknown tooling increases your stack amount in experience for your other team members