So I'm working on this project where I'm fetching data from my backend and displaying it onto my frontend. Currently, the project works locally and I'm trying to deploy it. However, I'm facing some issues. When I tried deploying it, I first drag my frontend (react) folder into the django project, then I did some configurations in settings.py. I added the template and static files, set CORS_ALLOW_ALL_ORIGINS to true and set debug to false. After that I ran npm run build and opened up the website and everything was going like I anticipated (datat fetched from the backend was displaying on the website). However when I was deploying the project on netlify, by uploading the build folder, the url generated the css and html of the website however it was missing all the data that I fetched in my frontend. I feel like I'm doing something wrong with the configuration because when I tried looking into the console of the deployed website it was saying that there was an issue with fetching the data. I'm not really sure how to resolve the problem so I appreciate any help or guidance.
#Trying to deploy a react/django project
5 messages · Page 1 of 1 (latest)
Hi, I think you'll need to add some more info for folks here to be able to help. When you say there was an issue with fetching the data, can you paste the exact error? If you are using Chrome, then that would be the error from the developer console, or at least the error code (i.e. 400, 404, 500).
I am not sure if I understood your problem correctly.
Is your frontend a React SPA where the index is being served through a django webview? If its not, and the frontend is being hosted independently then take a look at https://nextjs.org/docs/pages/api-reference/next-config-js/assetPrefix
/api/notes/:1 Failed to load resource: the server responded with a status of 404 ()
where is the backend deployed?