Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Django + Angular

Hassan
November 03, 2015

Django + Angular

An introduction on how to create more responsive websites using Django and Angular.

Hassan

November 03, 2015
Tweet

More Decks by Hassan

Other Decks in Technology

Transcript

  1. Who is Hassan?  Software engineer for 15+ years. 

    Corporate/Government Contracting  VioDrive
  2. The Point • The user experience with standard Django templates

    are old school. • JavaScript allows for a fast and fluid UI/UX. • Why not Angular!
  3. How To Make It Happen • Django will function as

    your back-end. • Django REST framework will expose your data as HTTP endpoints. • Angular will be used to develop the front end that will asynchronously interact with the application.
  4. Converting Django-Polls django-polls A simple and reusable polls application for

    django. https://github.com/byteweaver/django-polls $ pip install django-polls
  5. Setup the Back-end Django REST Framework – Web browsable API

    – Authentication (includes OAuth1 and OAuth2) – Customizable – Good documentation – Large online community
  6. Setup the Front-end Angular – Open source Javascript MVC Framework

    backed by Google. – Decouple DOM manipulation from app logic. – Decouple client side from server side. – Two way data binding. – Extensive documentation. – Large online community.
  7. Define Controller • Gets all current polls and list them.

    • Define a function to vote/view a poll. static/newpolls/app.js
  8. Define Controller • Define another function in the controller to

    allow a user to submit a vote. static/newpolls/app.js
  9. Define Templates • Django will serve the js files. •

    The Django template engine will render the index file. templates/newpolls/index.html
  10. Setup State static/newpolls/app.js • Tells Angular what to do when

    a user accesses a URL. • Ties controllers and templates together.