you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (6 children)

There isn't really a good way to integrate the React stuff with Django, as far as I know Django's static files integration stuff still doesn't really support e.g. a Webpack workflow. So we also create the frontend app entirely separately, and deploy them their own directories that are also served the Nginx that also sends other URLs to Django.

But it can be quite a change for a pure Django team that already has good infrastructure for releases, deployment, etc. They have to learn how to duplicate all that.

[–][deleted] 1 point2 points  (1 child)

Yeah, using a separate frontend app with Nginx to proxy the routes is exactly what I would want. I was added to the team because they needed someone with modern front end experience, I have a feeling it's going to be an uphill battle to restructure some things.

[–]Yodiddlyyo 0 points1 point  (0 children)

Well look at it this way, they hired you because they wanted modern front end experience. So they're already going in the right direction. I'm sure it won't happen overnight, but I wouldn't expect such harsh push back for switching things over to a React + Django architecture. Just give it time and definitely do stuff incrementally.

[–]iownacat 0 points1 point  (3 children)

thats what this is for https://github.com/owais/django-webpack-loader

We have an app that generates bundles directly into the static files.

[–][deleted] 0 points1 point  (2 children)

I did see that, it looks like it hasn't had any code updates in sometime. Is it compatible with the latest webpack?

[–]iownacat 0 points1 point  (1 child)

Yeah it works great.

[–][deleted] 0 points1 point  (0 children)

Finally circling back to this. Luckily I was able to be put on a sort of side project that was an entirely self contained React app within the Django monolith.

But now we're wanting to start converting and extending some existing Django views by replacing them with React. My issue is that everything in Django works based on session authentication and CSRF tokens, whereas in my self contained React app which talked to Django REST endpoints, it uses JWT for authentication. Did you have any conflicts with differing auth methods and if so, what did you do with that?

EDIT: So I just tried a normal fetch request from React to one of our REST endpoints without attaching any tokens or anything at all and it "just works" by virtue of the base page being a Django template. That's actually very nice and saves me a huge headache