I have a project consisting of the Django Rest Backend and AngularJS frontend. The project root directory contains two folders: backend
and frontend
, in the first one there is placed the whole Django app and in the second one the Angular frontend app.
Is it possible to deploy such a structure to Heroku in one subdomain. To be precise, I want to have urls like this:
myapp.heroku.com
- which will load the whole Angular project frontend
myapp.heroku.com/backend
- which will be the Rest API endpoint
How to deploy both apps on Heroku to obtain such a solution? Or maybe you have any other suggestions concerning the project structure and deployment?
Have a look at this project.
https://github.com/djng/djng
They've used a DjangoREST backend and a Angular Front end. Instead of letting heroku autodetect the app environment, they've managed to make a heroku app using 'Buildpacks' where, you specify that the project has multiple builds (heroku-buildpack-multi), then specify the python based buildpack and the angular based (grunt) buildpack.
There's nothing particularly special about this setup. Angular code is just static files, and can be served from whatever point you want; then the Ajax calls to the REST backend go to the endpoint you determined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With