Deploy React and Django on Heroku

For a moment I hit my head about this problem and cannot understand it. I am trying to deploy a Django application for heroku where it uses an interface. I am pretty new to reacting, so it’s possible that I don’t have something fundamental.

I have one heroku application right now that has two buildpacks (heroku / nodejs and heroku / python). To run the application locally, I use it python manage.py runservertogether with node server.json port 3000. I know that Heroku allows only one port to receive HTTP requests, so I think the problem is there.

My main question is: to use Django and React in a Heroku application, do I need to have two separate applications (one for django and one for the answer) or can I only support one application?

I was looking for this repository and it seems that only one application is being used. However, I do not see how the node server works.

Thanks for any clarification or push in the right direction! Let me know if I need to clarify my question.

Edit: A couple more things I tried:

  • Next this tutorial
  • Adding a heroku-postbuildscript to my package.jsonfile that starts the node server. This prevents the build process from continuing to start the django application.
  • I met this blog post , but it looks like I get conflicting information about whether the applications can be in the same Heroku application or should be different (for example, in the tutorial from # 1).
+4
1

( , ), .

, , - javascript, . , HTML/CSS/JS.

, webpack, javascript. , heroku-postbuild, ,

+5

Source: https://habr.com/ru/post/1664340/


All Articles