Flask is really impressing me. It lets me write very clean obvious code.
We are launching a new site, and need a blog ASAP. I figure it would be a pain to migrate blog hosts so I was curious what I can do with Shopify’s blog API.
I was able to..
- Loop through Shopify’s API until we get all of the blog posts. This takes a long time.
- Strip the funky HTML
- Parse HTML / find first image
- Cache the results for 30 minutes
- Split into pages of 25 / separate by pages
Some of the recommended caching plugins are just so useful right out of the box. cache.memoize will cache the results of a function for timeout building a cache key out of the function arguments.
cache.cached caches the result of a view. That means I can really easily and fluidly adjust caches as necessary to keep performance high, even though we’re making many requests to Shopify to get the posts themselves.
Check out the gist