I am developing a mobile app which is using Ionic (AngularJS) as the frontend and Django as the backend. I wanted to know if it is possible to use Django to expose data as a JSON web API that my app will consume through $http services. If so, how would I go about doing it?
I'm doing exactly the same so YES that works nicely!
Have a look at:
http://www.django-rest-framework.org/
It will provide you with a flexible REST framework to serve your data.
On the angularjs side, I personally would use $resource instead of $http as the promises are more flexible in my opinion. Especially the chaining using $q.all() can be very useful.
Once you get to the authorization of users, have a look here:
Authorization header in AngularJS not working
on some tips on how to get django rest talking with our app.
Have a look at this video for a great intro into using Django with Django Rest Framework and Angular:
https://www.youtube.com/watch?v=GVDjoTt3r8A
Sample app mentioned in video can be found here:
https://github.com/TrackMaven/Djangular
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With