miracle2k / django-assets

Django webassets integration.
BSD 2-Clause "Simplified" License
89 stars 79 forks source link

Determine to use staticfiles finders based on DEBUG #61

Closed dschep closed 8 years ago

dschep commented 8 years ago

Using ASSET_DEBUG, IMO, is the wrong way to decide on using staticfiles or not. django-assets should behave the same as staticfiles in how it finds files.

miracle2k commented 8 years ago

It used to be based on DEBUG, but was changed after some debate (e.g. https://github.com/miracle2k/django-assets/pull/17).

If we want to change it again, we'd have to think this through really well, and document the arguments pro and contra, so we don't have to do it again.

dschep commented 8 years ago

Hmm.. Is it possible to to use static finders when DEBUG is True and ASSETS_DEBUG is False? If not, is that such an uncommon use case that it isn't worth making possible? If it really isn't a usecase that is/will be supported, should it be checked for and warned about? Essentially:

if settings.DEBUG: assert settings.DEBUG == settings.ASSETS_DEBUG,\
        "django-assets doesn't support using static finders when ASSETS_DEBUG is false"
miracle2k commented 8 years ago

From the perspective of django-assets, this whole conditional revolves around one question of fact, as far as I can tell: Did the user run "collectstatic", and does he want to use the collected static files, or does we want to use the source files?

Which setting does represent that fact better? DEBUG or ASSETS_DEBUG? Arguable DEBUG, though as described in #17, during testing DEBUG may be false. Potentially none of them. Maybe a separate setting ASSETS_USE_STATICFILES should be added?

dschep commented 8 years ago

Cool, when I get time I'll look into fixing the tests with override_settings(DEBUG=True). If there's no way to make it work, I agree that something like ASSETS_USE_STATICFILES might be a good idea.