Sunday, January 25, 2015

Re: A sample project showing server side rendering with React and Django



On Sunday, January 25, 2015, bobhaugen <bob.haugen@gmail.com> wrote:
Ustun, do you think it is necessary to use a node.js server to interact with react.js on the client side? Seems like a lot of added complexity. But I could be missing something important...

Hi Bob,

This is definitely not the only way but I don't  think it adds that much complexity considering the advantages. You could have multiple node.js renderers, gain fault tolerance and performance via some distribution scheme like round-robin.  The nodejs renderer here is stateless and could be made even faster through memoization or caching (or cache could be handled on python side too before communicating with node)

Another alternative would be to use something like queues to handle communication between node and django, but that is more complex. 

The other alternative would be to fork a nodejs process on each call, for a high traffic site, speed might be more of an issue there. Some projects take that approach, I recently saw another django-react integration that uses that. (See django-node for this)

If you are on jvm, it is possible to use nashorn to do in process rendering. 

Best,

Üstün



 


On Saturday, January 24, 2015 at 7:13:56 AM UTC-6, Ustun Ozgur wrote:
Last year I gave a conference talk at Djangocon EU where I introduced React.js to the community. Since then, I have been getting some emails asking for some sample code.

I just published a sample project that simply uses a node.js server to delegate server side rendering from Django. Hope that this is useful to some newcomers. (Note that this sample doesn't show server side rendering via react-router, the route on the clientside is a single one) 

I'm planning to write a blog post explaining the code if there is any interest.



Ustun




 

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/-7oLnG_MaGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b7cca6c2-2b51-4bf0-8ade-d2776e3e77b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Ustun Ozgur

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAPx3A%2BtQFGVR8och725L_CTG0zocZPAuF%3DqvTJvaPi08GUJ%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment