Leverage Browser caching in Django Python application

Leverage Browser caching plays an important role into site performance and so better Google page speed score. In Django application it can be set up almost similar to php application.

Here are steps to do it into Leverage Browser caching Django application:


1. Enable Expire header module.

Make sure apache MOD_EXPIRES is enabled. Into most of hosting servers it comes enabled by default but you can check status by following command:

bash#: sudo apache2ctl -M

it will come up will list of all enabled modules. if you didnt find “expires_module” there then you need to enable it by following command:

bash#: sudo a2enmod expires

Restart apache service with following command:

bash#: sudo service apache2 restart

2. Set cache expiration into website configuration file:
Edit /etc/apache2/sites-enabled/mydomain.com.conf via your preferred editor and add following lines:

ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"

Save file, You may need to restart apache service again to take effect.
Your google page speed score should be improved now.


Mobile vs Tablet : The Future

Everyone is crazy about new Gadgets these days, Everyday a new company comes up with new mouth watering gadgets, There is always a war between Mobile and Tablet, So here are some of the points that one might consider while choose the gadget between the two.