-
Notifications
You must be signed in to change notification settings - Fork 69
Collectfast breaks with local filesystem storage even when disabled #120
Comments
This definitely looks like a bug, thanks for reporting it. I will accept a patch for this as long as a test case is added (that fails with the current implementation). I would prefer checking if settings.enabled and self.storage.preload_metadata is not True:
... |
I'd be happy to submit a PR @antonagestam . One question though: I'm trying to figure out how to change the Could you please point me at the right direction? Thanks! |
we also ran into this issue after upgrading collectfast at work, so would like to see this get fixed... @johananl I'm assuming the I think we need two tests: (1) the test discussed: collectfast is disabled and default storage is used; (2) a test where collectfast is enabled, but the staticfiles_storage is set to the django default. I'm not sure what the expected behavior is in that case, but we should be deliberate about it. |
@johananl https://docs.djangoproject.com/en/2.0/topics/testing/tools/#django.test.override_settings We could change the name of |
Good to hear we're not the only ones, @pachewise :-) Thanks! |
Perfect @antonagestam - the Django @pachewise - thanks for your advice regarding the tests. Regarding number 1, this test case already exists: @test
@override_setting("enabled", False)
@with_bucket
def test_collectfast_disabled(case):
clean_static_dir()
create_static_file()
call_collectstatic() As for number 2, I think the expected behavior should be exit with an error, since collectfast should only be used with S3 (right @antonagestam?). In addition, I would also add a test case with collectfast disabled and the storage is Django's default (filesystem storage). This is in fact the trigger for this bug. |
thanks for working on this, Johan! by (1), I meant the test you're describing for the bug: by default storage, I meant the django default (StaticFilesStorage) |
Thanks for clarifying @pachewise. Then yes, looks like both your suggested test cases will be included in my PR. |
Please see #124. @antonagestam @pachewise - please feel free to comment and suggest changes. I hope I've managed to handle this properly and make Collectfast a little more stable. |
Hi,
Thanks for publishing this project. It is very helpful :-)
I've encountered the following issue:
When using Collectfast in disabled mode (for local development without S3), running
./manage.py collectstatic
breaks even with--disable-collectfast
orCOLLECTFAST_ENABLED = False
. The reason seems to be the following:collectfast/collectfast/management/commands/collectstatic.py
Line 35 in ced213e
When using filesystem storage, collectstatic crashes with the following:
This happens because
StaticFilesStorage
doesn't have an attribute calledpreload_metadata
(I believe it is S3-specific).To reproduce this issue, simply run
./manage.py collectstatic
withcollectfast
inINSTALLED_APPS
and a default storage configuration.I believe this can be solved by something similar to the following:
The following is also possible to avoid the import:
What do you think?
Thanks,
Johanan
The text was updated successfully, but these errors were encountered: