5

So I googled around for the answer to this question and found a way to deploy just a react app to github pages using this medium article. The issue is my react app has a django back end. So github pages won't work. I also know how to deploy a django site to heroku. I also know you can deploy a react app to heroku. But deploying them separately makes them have different domains. Now is there a way to deploy a fullstack django and react app to heroku so both has same domain?

1 Answer 1

2

Things you could do:

  • Use subdomains for the two parts. e.g. www.yourdomain.com for the frontend and api.yourdomain.com for the backend. You could do this without changing your current hosting strategy, just by redirecting from the subdomains to the respective hostings.

  • Host your react app on heroku as well and use the heroku domain services. This might need a small NodeJS wrapper for the react app to make it run but it's not too much effort

Sign up to request clarification or add additional context in comments.

2 Comments

For the first option, I dont need a real custom domain as the project is a practice one, so imagine after hosting the django backend on heroku and get a domain 'yoursite.herokuapp.com', how do i add the frontend react part to it?
I don't think this is possible since you don't actually get access to your heroku domains. You'd need an actual top level domain with access to the dns records. For practice projects you could just get a free domain over on dot.tk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.