Integrating Django and Angular by creating REST API and running both the servers separately
-
Create virtualenv using pipenv
pipenv install django djangorestframework django-cors-headers python-decouple
-
Activate virtualenv using
pipenv shell
-
Start Django project
django-admin startproject backend .
-
Run migrations and create super user
python manage.py migrate python manage.py createsuperuser
-
Start frontend Angular project
ng new frontend --style=scss --routing
NOTE: I assume that you have NodeJS and NPM installed in your local computer
--style=scss
creates the styling file inscss
format.--routing
creates the routing module for the angular project -
Run angular server
ng serve --open