I have already created an App using Django for my client. Now, I wish to separate the backend and frontend. Backend will be Django Rest Framework, and the frontend will be Angular 12. How will I host this on the same app? I can only find tutorials for one or the other, but not both.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey there!
You should be able to create the Angular frontend as a static site component within your application. You would then build the Django application as a webservice component within your application. The Django app would need to be configured to use a different route such as /api You could then reach the Angular frontend on / and the Django app on /api.
Unfortunately there isn’t a specific guide currently to cover both of these, but I’d recommend adding that as an idea here.
Hope it helps! Nate
Heya,
You’ll need to use different packages for PWA as well. I recently deployed a Django with DRF with PWA using this package:
# PWA compatability
django-pwa
I suggest for anyone stumbling upon this to just give a read of the offical docs of django-pwa - https://pypi.org/project/django-pwa/
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.