Z
Z
zelsky2016-01-21 02:29:24
Django
zelsky, 2016-01-21 02:29:24

What's the best way to render?

I took several courses on JS and the Angularjs framework. Liked it very much.
Here is the question. What is the best way to render content, return from django through templates?
Or return Json, and already process it using angularjs ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Shubin, 2016-01-21
@zelsky

It all depends on the specific task. But if you are making a Single-Page Application, then the main (index / home) page should be rendered with a template, and the rest of the information should be pulled with JSON. Or for each section, render a template, and the rest, again, through JSON. However, such games are bad for SEO, since search robots do not know how to use JS, so you need to strike a balance (if SEO is necessary) - render important information with templates, the rest (notifications, new comments, buttons, settings) can already be drawn on the page through Angular .

V
Vladimir T., 2016-01-21
@vachuahe

If you have angularJS on the client, then only data should be returned from the backend - in your case, return JSON. If the SEO issue is especially important, then screw prerender.io or replace angularJS with something else more suitable for an isomorphic application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question