datamade / how-to

📚 Doing all sorts of things, the DataMade way
MIT License
81 stars 12 forks source link

Make django conditional view processing SOP #234

Open fgregg opened 2 years ago

fgregg commented 2 years ago

Background

When we have a django site that is pokey, we tend to reach for two tools: improving the performance any underlying SQL, and caching. Django has another tool, that I've never seen us use: conditional view processing.

https://docs.djangoproject.com/en/3.2/topics/conditional-view-processing/

Basically, this approach is allows the user's browser to make much more effective use of the browser cache, making their pages load much faster and reducing the hit on our servers and application.

Adding conditional processing looks like it will often be very unobtrusive and as such, it may be something we want to have as SOP for django views.

Proposal

I'd like to do a spike of this on BGA payroll and confirm that adding the conditional view decorators are in fact unobtrusive. In also want a good understanding of any potential troublesome interactions with caching.

Deliverables

A PR for BGA that looks good.

Timeline

If this takes more than one investment day, then it's not as easy as I think it should be.

smcalilly commented 8 months ago

@fgregg this is interesting, is this something you still want to do?

maybe related to:

fgregg commented 8 months ago

yes, i do. this maybe a good thing to try out on chicago councilmatic.