Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Django's system check instead of a log warning #157

Closed
wants to merge 2 commits into from

Conversation

etianen
Copy link
Owner

@etianen etianen commented Dec 18, 2022

Tweaks applied on top of #156.

Closes #153
Closes #156

jnns and others added 2 commits December 9, 2022 14:18
This allows silencing the warning in case the user knows what they are
doing.

The check for AWS_S3_BUCKET_NAME is left untouched because it looks 
like even checks of level ERROR or CRITICAL can be silenced.
Raising an exception seems like the better option to me.

Closes #153.
@etianen
Copy link
Owner Author

etianen commented Dec 18, 2022

Ah, this is more complex than I thought.

Really, this check needs to be a part of the storage class, since we need to check both the static file storage and the file storage classes, as well as any additional storage classes that the user might manually create.

I implemented this approach in #156, using your code as a starting point.

However, Django instantiates the default file storage (and the default staticfiles storage), lazily. Meaning the per-storage checks implemented in #157 don't fire.

The proper solution is probably the one in #157, but to actually get these checks to fire, we'd need to eagerly instantiate the default file storages, which would be suprising behavior to users.

Thoughts, @jnns?

@etianen etianen closed this Nov 4, 2023
@etianen etianen deleted the jnns-system-check-153 branch November 4, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Django's system check framework instead of log message
2 participants