Django and AngularJS 2
James Pacileo @ignighted
- It is a full top down framework
- Speed is now competitive with React
- AngularJS 1 scope hell removed
- Easier to build independent components and services
- Typescript! (Unexpectedly a time saver)
- ES6 + more
- Optional types (life saver for super complex Angular projects)
- Most JS libraries out there are supplied with types
- async await (great alternative for callback and promise nesting)
- Interaction with internal develpment APIs can be sane via supplied types
- More verbose
- Different API
- Potentially more Javascript Burnout
- For starters... it's a Django Meetup :)
- Django-Rest-Framework is marvellous
- Speed of development and maturity of the framework (haven't seen anything as good in NodeJS yet)
- Typescript instead of Javascript
- Static files are compiled via "webpack" (following best pushed best practices)
- Django prefers simple static serving
- Possible maintenance issues (we don't want an overly complex project... let's KISS)
We could manage the pipeline from Django
- django-pipeline
but no official support for Typescript yet
Alt. we can write our own management command script
We could use the widely used...
django-compressor
Unfortunately client-side apps are
Split em!
the Django backend
and
the Angular 2 frontned
- The client-side tools are continually changing (and that means the Django implementation)
- A JS client-side can be insanely complex (let's keep that away from our Djangos)
- A Django-centered pipeline may become a bottleneck
- It can worsen burden on backend devs
- KISS
- The Django backend becomes a simple API service
- The client side manages templates, static files and code compiling/transpiling
- We separate them in two separate version controlled code bases, each with it's own separate tests
- We enable API versioning (available in Django REST Framework) and enable API version checks
- The Django backend becomes a simple API service
- The client side manages templates, static files and code compiling/transpiling
- We separate them in two separate version controlled code bases, each with it's own separate tests
- We enable API versioning (available in Django REST Framework) and enable API version checks
Other tools
docker-compose
Qucik & Simple
ADD ./requirements /home/docker/requirements
RUN pip install -r /home/docker/requirements/production.txt
ADD . /home/docker/code
docker-compose run django_app bash
BONUS TIPS???
Tip 6 - Local hostnames