Django is one of the most complete web development frameworks available. With the power of Python, we can get an application up and running in just about no time. It manages everything from the database to the final HTML sent to the client.
However, with the advent of Single-page applications (SPAs), it’s become increasingly common to create applications that use Django only to provide an API that responds to JSON data consumed by applications developed in the most varied JavaScript frameworks. It’s actually a trend that the majority of languages are following.
This architecture (that separates the front from the back-end) allows a better decoupling of them both, with teams that can develop in their domains completely independently. It also enables multiple client apps to interact with the same API, while ensuring data integrity and business rules, and a variety of user interfaces.
On the other hand, two different projects generate even more work: two separate deployments, two different environments to configure, etc. One way to simplify this is to use Django’s own capabilities to serve static files. After all, the front end application is nothing more than a set of files of this type.
In this article, we’ll outline how to create a simple CRUD API with Django and its famous Django REST Framework free from CORS common issues, and integrate it with a React app. We’ll cover everything from setup and configuration to the customization of our front-end components and back-end API. You can expose your API in different ways with Django. While GraphQL is a safe bet, we’re going to use traditional REST endpoints.
Read more of this tutorial at logrocket blog site.