There is no way to use both django-compress and django.contrib.staticilfes from new django 1.3. MEDIA_URL and MEDIA_ROOT hardcoded into django-compress utility functions so here is
my fork of django-compress on github with fix.
I've added two new settings COMPRESS_URL and COMPRESS_ROOT which points by default to MEDIA_URL and MEDIA_ROOT respectively for backward compatibility.
django-compress is extremely useful tool which provide possibility to organize your JavaScript and CSS files around your project. Also there is a couple of useful features like support of YUI compressor and building of bunch of JavaScript or CSS files into one.
Read more about django-compress
Hi Max,
ReplyDeleteYou should have a look at django-compressor (https://github.com/jezdez/django_compressor), from Jannis Leidel, which is also the author of django-staticfiles - which is now included in Django contrib.
zyegfryed@, django-compressor is awesome but there is absolutely another approach to solve same problems. I mentioned in my post that main feature of django-compress is organization of my code - all necessary css/js files stored in configuration dictionary
ReplyDeleteboth solutions are not really good. they are too slow and too problematic. better is to compile/minifty/join static stylesheets and javascripts at buildtime for specified files in project.
ReplyDeleteMarcin Nowak@, I'm not quite sure that you're used django-compress. It's django-oriented replacement for naked Makefiles or ant for building project at buildtime. You just need to use python manage.py synccompress and django-compress update/recreate static files. Obviously, it should be part of your deployment utility.
ReplyDeleteMax, you are right. It was django-compressor not django-compress. Compressor does not have synccompress command.
ReplyDeleteDjango-compressor is crashing at runtime (even in production env) when source files are unaccessible.
I'm still wondering about using Django for generating static files. I prefer a buildout-like solutions using c2c.recipe.cssmin, c2c.recipe.closurecompile or collective.recipe.minify. Any missing files will be reported at buildtime, not runtime.
@Nowak: that's not right, django-compressor comes with a management command to do offline compression. http://django_compressor.readthedocs.org/en/latest/usage/#pre-compression
ReplyDelete