Cache by resource type
Caching is not simply setting everything to one year. Blog pages, uploaded images, CSS, and JavaScript change at different speeds and need different rules.
HTML pages such as the homepage, article pages, and category pages should remain fresh. Uploaded images can be cached longer if filenames are unique. CSS and JavaScript can be cached when their URLs include a version or hash.
Let Nginx serve static files
Static files should usually be served directly by Nginx instead of passing through Python. A simple /static/ alias with cache headers can reduce application load and improve first-page performance.
Use unique filenames for uploads
Long image cache only works if the same filename always means the same content. Do not store every uploaded cover as cover.jpg. Generate random names or content-based names, then resize and compress images during upload.
Version CSS and JavaScript
If users keep seeing old styles after deploys, the problem is usually caching without versioned URLs. Add a version query string or hashed filename so new releases request a new asset.
Avoid caching private pages
Admin pages, login pages, and account pages should not be publicly cached. Performance must not compromise correctness or privacy.
Takeaway
Cache images aggressively, keep HTML fresh, and version CSS and JavaScript. This gives a small blog better speed without confusing users after updates.