News for hackers. Stuff that matters.
Re:Ask HN: Is it a good idea to build a Single Page App with... by detaro on Friday February 26, 2016 @10:00AM (#11181682)
If you stick to Django, you probably want to look at http://www.django-rest-framework.org/ for the backend.
Re:Ask HN: Is it a good idea to build a Single Page App with... by virtualmic on Friday February 26, 2016 @10:56AM (#11182008)
Am developing two mid-size apps using DRF and Angular. DRF has proved to be quite easy to work with.
Re:Ask HN: Is it a good idea to build a Single Page App with... by IgorPartola on Friday February 26, 2016 @10:16AM (#11181753)
I personally find DRF to be my as nice to work with as Django itself. If I can get away with not using it, I avoid it.
Re:Ask HN: Is it a good idea to build a Single Page App with... by wingi on Friday February 26, 2016 @10:12AM (#11181738)
Yeah, you will need only a small REST interface for the single page app ...
Re:Ask HN: Is it a good idea to build a Single Page App with... by cneumann81 on Friday February 26, 2016 @10:47AM (#11181946)
Would you rather use anything else? Flask for instance?
Re:Ask HN: Is it a good idea to build a Single Page App with... by detaro on Friday February 26, 2016 @10:56AM (#11182010)
I feel like that is a matter of personal taste and what your data sources are behind it. Flask makes it easier to do whatever you want, but you also have to do many things by hand, where Django has an included "right" way of doing them.

This recent HN discussion had many opinions and details to read through: https://news.ycombinator.com/item?id=11121355

Re:Ask HN: Is it a good idea to build a Single Page App with... by brwr on Friday February 26, 2016 @04:12PM (#11184281)
I've spent a lot of time working with Django as a backend and AngularJS powering the client. It's definitely not a bad combination.

That said, in my personal projects, I lean towards letting Django handle almost all of the client experience too. There are exceptions for areas that are inherently interactive (e.g. WSYIWYG editor), but the vast majority of my projects involve static content. To me, the complexity and overhead of using a JS library/framework outweighs any benefits the library/framework might offer.

Re:Ask HN: Is it a good idea to build a Single Page App with... by chrstphrhrt on Saturday February 27, 2016 @02:07PM (#11188019)
I have worked with DRF in the past. It is a very nice framework. However, I came to believe that it is too low-level for new projects. Do you really want to handle at least the following pieces of boilerplate for every API or endpoint?

- Request parsing

- Content negotiation

- Creating/rendering responses

- Subclassing or decorating custom views and/or viewsets

- Model mixins, CRUD glue

- Routing

- Content-type parsing and rendering

- Serialization/deserialization

- Validation

- Authentication

- Filtering

- Pagination

Personally, I found it was harder to get from zero to anything when having to slog through that level of verbosity. I'd rather save brain cycles for harder problems.

It was this experience on the job that led to the design of a better approach with Ramses: http://ramses.tech. You can also generate docs, tests and client libraries this way. If you like the look of that, I will make you an end-to-end prototype for free to help drive home the concept.

Some other awesome projects along the same lines are http://postgrest.com/ and https://flask-restless.readthedocs.org/en/stable/

Re:Ask HN: Is it a good idea to build a Single Page App with... by calcsam on Friday February 26, 2016 @10:05AM (#11181699)
I've been having success using Django / React together with this: http://owaislone.org/blog/webpack-plus-reactjs-and-django/
Re:Ask HN: Is it a good idea to build a Single Page App with... by japhyr on Friday February 26, 2016 @10:21AM (#11181777)
You might take a look at Lightweight Django: http://shop.oreilly.com/product/0636920032502.do
Re:Ask HN: Is it a good idea to build a Single Page App with... by imauld on Sunday February 28, 2016 @03:50AM (#11190374)
Depending on how complicated your API is, you may not need something as heavy as Django. This is a neat little framework if your backend doesn't need to heavyweight:

http://falconframework.org/

It's pretty unopinionated so you have a lot of control and there are less surprises but a lot of the nice to haves are gone as well.

Whatever you go with I would read this as well as the DRF doesn't generate proper RESTful responses on it's own.

http://jsonapi.org/

Re:Ask HN: Is it a good idea to build a Single Page App with... by jakjsak on Friday February 26, 2016 @10:55AM (#11182004)
Related question. Is Django still a good choice for web apps? I mean should I choose one of the newer ones or is Django good enough?
Re:Ask HN: Is it a good idea to build a Single Page App with... by brianwawok on Friday February 26, 2016 @11:45AM (#11182347)
It seems popular still. Do you want a batteries included python web framework? Can't do much better.

In your case, a SPA is not using a lot of Django stuff. So do you really like the admin pages and the ORM? If so use it. If you don't need admin pages and you hate the Django ORM, maybe look at just using Flask?

-- Only used Django a few times so not an expert, but above is my gut feel.

Re:Ask HN: Is it a good idea to build a Single Page App with... by ralmidani on Tuesday March 08, 2016 @04:15PM (#11248712)
Is your app data-driven? If yes, have you considered Ember.js? At my startup, we're using Ember + Ember Data backed by an API built with Django + Django Rest Framework, and we couldn't be happier with the conciseness and elegance of our code.
Re:Ask HN: Is it a good idea to build a Single Page App with... by waterlesscloud on Friday February 26, 2016 @10:59AM (#11182030)
Literally a single page? Static content? No, Django is not what you want.

You want to hand-build and hand-tune that page.

Re:Ask HN: Is it a good idea to build a Single Page App with... by IgorPartola on Friday February 26, 2016 @10:16AM (#11181755)
Yes. I have done this with Django and Angular 1.x. Works really well.