Report this

What is the reason for this report?

Host a Django Angular PWA

Posted on November 16, 2021

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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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/

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.