Locally, I am able to run my django app and react app. I migrated the django app to the azure web apps. My question is, what is best practice regarding connecting the react app to the django app. Should I start another web app instance, or should I try to run both on the same instance?
CodePudding user response:
The easiest way is that both React and Django are deployed on the same instance, however it depends on your need.
There are many ways to deploy Django React, I will mentioned only two:
Simple one: Just import react libraries into your Django template and deploy your Django on the instance as a normal Django project. You may refer to this tutorial on how to accomplish this: Add React to Django Template
Second way which I would recommend: Deploy Django and React separately. Django app to be deployed on the Azure instance and react to be deployed as a static website on Azure Blob storage (You may refer to this tutorial: Host React on Azure Blob). In this case, your react app will be using the Django exposed APIs (through Django DRF). You may refer to this tutorial for further details: Deploy React Django