Sunday, September 2, 2012

Re: setting up Django Compressor

Just to cover the basics, did you follow all installation steps described here:
http://django_compressor.readthedocs.org/en/latest/quickstart/#installation

Mainly adding 'compressor.finders.CompressorFinder' to STATICFILES_FINDERS


Another thing kind of odd is that your css URL starts with /media/. Whats your STATIC_URL and MEDIA_URL setting? Check this out: http://django_compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_URL

It looks like its defaulting to MEDIA_URL, but you said you were using Django 1.4, which should have STATIC_URL available.


On Sunday, September 2, 2012 11:13:53 AM UTC-3, Phil wrote:
Hi Joni,

Thanks a million for reply.

Yes I am using django runserver, its a working site just trying to get compressor working locally before moving to production. My css works fine without the compressor app. I can't see the file if I copy it in my url I get a 500 error and the "CACHE" folder doesn't seem to exist anywhere. I didn't have anything in my "urls.py" for media, but I added the following to see if it would help but it still didn't work...

*******************
if settings.DEBUG:
    urlpatterns = patterns('',
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
    url(r'', include('django.contrib.staticfiles.urls')),
) + urlpatterns
*******************



On Saturday, September 1, 2012 3:09:42 PM UTC+1, Joni Bekenstein wrote:
The generated css file seems to be in your media directory. If you copy that URL, can you see the css file? Are you using Django's dev server (runserver)? If so, did you add to your urls.py a view to serve the media files? (and that view should only exist when DEBUG is true since in production you're probably going to serve static files and media files directly with your webserver)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/0iBQbggGm8UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment