Settings

Theme

Getting Started with Django REST Framework and AngularJS, Part 2

engineroom.trackmaven.com

106 points by joshfinnie 10 years ago · 33 comments

Reader

wylee 10 years ago

I use DRF with Angular at work, so I'm interested in seeing where this series goes.

Tangentially, I can't imagine using Django without DRF. It makes setting up RESTful(ish) APIs so easy. Even if you don't care much about the RESTful aspects, it provides a much nicer way to organize your code than default Django IMO. I especially like how serialization works versus Django forms.

  • collyw 10 years ago

    I found the best thing about DRF was how well it conforms to Django conventions. Model serializers work very like model forms and the class based views are almost the same.

adpirz 10 years ago

If you're looking for a good DRF / Angular tutorial, I'd highly recommend https://thinkster.io/django-angularjs-tutorial

riebschlager 10 years ago

Aww, what a tease. This is exactly what I'm diving into right now. Since part one was written in November, I'm guessing part three might show up around March?

Anyone have any worthwhile Django learning resources to share? (Other than Django's own docs, which are great.)

  • travjones 10 years ago

    There's a book called Django by Example by Antonio Mele that I think is pretty good. People love Two Scoops of Django as well. The former consists of a series of tutorials and the latter explains best practices to consider when writing Django apps.

    • sdrothrock 10 years ago

      Do either of those talk about Django and scalability/duplication? The two biggest problems I've run into looking for other resources are:

      1. Versions -- a lot of printed materials are just old by the time they come out.

      2. None of them talk about large-scale projects, only smaller-scale personal blogs etc. as a first project. Or, put another way, many of the resources I find target beginners instead of intermediate/advanced learners.

      • travjones 10 years ago

        Scalability--not so much. If you were really interested in building a highly scalable service (5M+ concurrent users) you probably would want to look at a different tool/language. But, chances are, Django works just fine for your initial/early use cases (before what you're building goes "viral" lol) and for most web app use cases on the internet. Duplication--yes. If you are talking about duplicating project boilerplate, Two Scoops gets into this topic specifically (using a neat package called cookiecutter). If you mean replication (e.g., horizontal scaling via replication of instances of your app), then that's more of a dev ops thing and depends on your deployment setup. I would suggest digging into literature about AWS, or whatever PaaS you choose.

        1. Versions -- both books target Django 1.8+ (Django 1.9 is the current, stable release), so I would consider both relevant for now.

        2. I suggested both books because both are current and different. Django By Example includes examples of projects beyond a simple blog (I think that's chapter 1 or 2). Each chapter introduces more and more complexity with a totally separate project example. Whereas, Two Scoops of Django provides general recommendations for how to best manage common Django tasks/flows. I think both are appropriate for intermediate/advanced users.

      • somecallitblues 10 years ago

        https://highperformancedjango.com/ awesome book covering what you need

      • jensv 10 years ago
    • lukewrites 10 years ago

      I am about a third of the way through Django By Example and would also recommend it for someone who has gone through the Django Tutorial and is looking for more.

      I've found books by Packt Pub to be of variable quality, and DbE does have some typoes/errors, but the content so far has been quite good.

  • joshfinnieOP 10 years ago

    Part 3 will be coming out sooner than March I hope. The reason for the gap in releases was the holiday season, we should be able to get them out more reliable going forward.

  • ericmsimons 10 years ago

    Yup - this course for using Django with AngularJS is by far one of our most popular: https://thinkster.io/django-angularjs-tutorial

  • misiti3780 10 years ago

    two scoops of django is decent, but it doesnt talk about the DRF. I am going to be adding a blog post about this in a few days, Ill send you a link when I am done - drop me an email if you want me to email it you.

Emouri 10 years ago

Neither Django Rest Framework nor AngularJS is actually used in this post..

  • ihsw 10 years ago

    In the title:

    > (Part 2)

    Here is part 1:

    > http://engineroom.trackmaven.com/blog/getting-started-drf-an...

    And at the end of the article:

    > A lot was covered in this post so this is a great point to end on. Look for the next post soon, covering API endpoint creation, including views, serializers, and URL routing for the Retail application.

  • tangue 10 years ago

    This reminds me of the kickstarter to build django tutorials. Lots of talks and finally halting halfway ... That's the difference between Django and Rails (and now Node). Ressources are scarce and unreliable ...

godzillabrennus 10 years ago

This is great! There is always room for more documentation on Django.

pbreit 10 years ago

It's shocking to me how something that should be so easy becomes so complicated. Why does the file structure need to be re-configured? What the heck are the __init__ files?? Virtual environments?

I sort of know the answers but remain unsatisfied.

And then the author sets up a needlessly overcomplicated data model situation.

  • travjones 10 years ago

    With all due respect, this tutorial might be a little over your head, but a little bit of research will get you up to speed. __init__ files and virtual environments are not specific to Django or DRF. These are typical patterns used in python development. For example, using a virtual environment allows you to have a self-contained python environment (your choice of version) with package management through pip. This is enormously useful when writing apps--you've got python and dependencies all in one spot contained in its own environment.

  • morgante 10 years ago

    Django Rest Framework is hands down the easiest way to build an app I've ever seen. I can have a full API for most apps built in just a few hours.

  • metaphorm 10 years ago

    can I ask a serious question? are you possibly not the intended audience of this article? have you done any non-beginner work using Python and/or Django in a production environment?

    • pbreit 10 years ago

      I'm slightly past this article but not much further. I check out a lot of "getting started" tutorials because I'm still frustrated with the "getting started" experience of a lot of frameworks/approaches. I just don't see why it's so complicated to do things that seem like they would be pretty easy.

      • alexcabrera 10 years ago

        How else would you suggest a python interpreter know to treat a directory as a module?

        • pbreit 10 years ago

          Why a computer couldn't figure that out (whatever that even means) is a total mystery to me. Makes no sense at all.

  • broknbottle 10 years ago

    pretty standard stuff if you're familiar with python...

    • pbreit 10 years ago

      That's the scary part. How having blank __init__ files in every folder is "standard stuff" is beyond mortal comprehension.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection