> On Aug 16, 2016, at 2:16 AM, Curtis Maloney <cur...@tinbrain.net> wrote:
> 
> On 16/08/16 09:10, Bobby Mozumder wrote:
>> Hi,
>> 
>> I also use generators for my views, and I use Django’s streaming views
>> with my generators to stream responses, so that the web browser receives
>> early responses and start rendering immediately before the view is
>> completely processed.  The web browser receives the first HTML fragment
>> before I even hit the database.
> 
> The hazard here is if anything raises an exception you've already sent 
> headers to say it didn't... typically this results in pages terminating part 
> way through.
> 
> Other than this, it is certainly a great way to overlap some transport 
> latency with work.  I've done the same with a generator-based JSON serialiser.
> 

I do have the option to query the database once to check if a URL is valid, 
before returning a response. This would also read most of the page’s data in 
the same query.  But right now I’m just letting the URL resolver figure out if 
the page is valid before it hits the database, which can lead to incorrect 
responses given a mangled URL.

All other queries after the primary query are for secondary data - the 
“additional links”, the “categories”, the “further headlines” type of data, and 
those queries would only work if the primary query works as well.  

-bobby

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/19C8C0A2-76B7-4807-A2F9-06DCB5ED26E2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to