How to setup Django + React on hosting?
How to setup Django + React on hosting?
I've done Django + React application.
I build React code using 'npm run build' and moves that files to hosting together with Python files, I've set up static files in Django app, and now when I'm going to site URL, I see that all static files are loaded. But they don't run. And when on the local environment I saw pretty JS app, now on hosting I see a white screen and when I select compiled JS files in Network tab in Developers Tools (Preview response) I read message "You need to enable JavaScript to run this app." (for CSS too).
I know that this is a noob question. But can you help me to solve this issue?
Thank you.
1 Answer
1
Check this site out https://www.techiediaries.com/create-react-app-django/
And go down "Integrating React App with Django in production"
This will show you how your app should be structured with the correct settings in your django files.
Hi, thank you for an answer! Problem was in static files (urls and pathes was wrong).
– Ulianka Shu
Sep 10 '18 at 0:37
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Can you provide your template where you are serving JS bundle ?
– Artem Bernatskyi
Sep 9 '18 at 17:47