Hello, I have a question related to Jango and React.

Asked 2 years ago, Updated 2 years ago, 482 views

Hello, I am currently making a website with Jango and React. Janggo was made into API using restframework, and React was made to approach API and show at the front desk. One of the apps in the Django project is rendering at the front desk using Django template without using React, but I don't think there's a big problem in the development process, so there could be a problem in the distribution process. No matter how much I search, it's hard to find a way to distribute this structure.

The approximate structure is

-frontend(react)
-api
-djangoApp

In this way, the front end is rendered with a react and the djangoApp is rendered at the front desk. I'm most worried about the process of collecting static files and finding paths, but is it possible to distribute them well without any other options? We will use aws for distribution. I would appreciate it if you could leave a comment if you have similar experience or if you have any materials to refer to.

Thank you!

django react restframework

2022-10-02 01:00

1 Answers

It shouldn't be a big problematic.

In short, can the server concurrently serve some of the client functions? I think it's a matter of, although it's a great thing to separate the client and the server 100 percent, it's not necessarily the case. In real-world projects, it is often unavoidable to do so. For example, in the process of implementing Google OAuth login, Google needs a page (route) to call back somewhere on our homepage, but if you are using a hash router, the server may create and spray a dedicated view because the hash you put in the callback URL is chewed. If you log in well, no one says anything.

As long as you understand the point, there's nothing to be confused or worried about. It's called an API server, but it's actually just a web app that accidentally responds with Content-Type: application/json. Think of it as a client reaction because you can't show it to the customer as it is. Then, if the API server sometimes gives you a response with Content-Type: text/html where necessary, you can skip the reaction. If you focus on the contents of the service and maintain the right line, you can think more flexibly about who will draw the view, who will use what file, and whether to apply it to the operating group.

I hope that's the answer.


2022-10-02 01:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.