Deploying DjangoREST+React project on a single google cloud app engine instance. Is it possible?

Viewed 526

I have a Django backend that communicates with the React.js based frontend using REST APIs (made using DjangoREST Framework).

Up until now all the similar projects that I have deployed on gcloud use two different gcloud projects/app engine instances, one for django and the other for react.

This time I'm constrained to use a single app engine instance. Is it possible to deploy both the react and django components together?

I am aware we can serve react as static files using django, but then would there be a performance decrease? And I still need to be able to access django admin.

1 Answers

Yes, It is possible to deploy both react and django components in same app engine service. You will need to add the handlers in app.yaml e.g.

handlers:
- url : /api/   #backend
  script: ....
- url : /
  static_files: frontend/index.html  #frontend
  upload: index.html....
Related