We have a couple of things to do here, then we will move on to preparing the React project.
In settings.py:
Set DEBUG to the value of the DEBUG environment variable and update ALLOWED_HOSTS to include the ALLOWED_HOST environment variable added to your env.py file
Now that we have the two parts of our application within the same workspace, the CORS issues with the original separate projects are no longer a problem. This is because both parts of the project will come from the same base URL. Therefore, we can remove most of the code in the Django project relating to CORS.
In your settings.py file remove the line containing the import re
Remove all the CORS code, leaving only the CORS_ALLOWED_ORIGINS list
Before:
After:
We need to make some changes to our React project for the development environment.