[Answered ]-How to use Django with Angular-cli@webpack

2👍

Integrating Django with Angular 2+ apps generated using the Angular CLI is easy and straightforward. You can simply follow these steps, depending whether you are in development or production.

In development : having 2 servers is not a problem .

First navigate inside your Django project then generate an Angular app with Angular CLI.

Configure Angular CLI to use the builtin proxy ,so you can avoid the Browser Same Origin Policy when sending requests from your Angular application to your Django backend.

Start the Angular CLI server and Django local server in 2 separate terminals.

In production: you have to use only one server.

You can’t have tow servers so you need to build your Angular app into dist folder then use Django to serve the index.html file inside that folder.

You can follow the detailed process in this tutorial.

👤Ahmed

Leave a comment