Django css and js files gzip compression on heroku

I am trying to compress my css and js files and serve as a gzip file, but without success.

I tried all methods, django-pipeline, django-compressor, etc.

I got django-compressor for creating gzip files, but I'm not sure how to serve them. I use GzipMiddleaware to compress and maintain my html files.

Can someone write a walkthrough on how to gzip and serve static files on heroku django.

I apologize for the detailed steps, I do not ask to be fed with a spoon, but I tried this problem for almost 24 hours, tried n number of solutions, but nobody works.

FYI, I am using django-1.5

Thank you in advance for your help.

+4
source share
2 answers

You should seriously consider uploading your static files to s3. Django does not actually shut down for working with files, and it will spend precious resources on your application server to do this.

Here are some good reasons to use s3 for static files. http://blog.doismellburning.co.uk/2012/07/14/using-amazon-s3-to-host-your-django-static-files/

Here is an article explaining how to get S3 to serve gzip resources: http://www.jamiebegin.com/serving-compressed-gzipped-static-files-from-amazon-s3-or-cloudfront/

Here's a storage database that will collect static data in s3.

, , , , gzips s3, - django-.

+2

. grunt, , .. .., django-compressor, !

Heroku, gzip , .

- wsgi-, gzip, dj-static, . dj-static, . , .gz, , . Heroku.

https://github.com/hdickson/dj-static

Dev-, - django, --nostatic . .. python manage.py runningerver 0.0.0.0:80 --nostatic

0

All Articles