这是indexloc提供的服务,不要输入任何密码
Skip to content

Add backend for using default static storage #97

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

Merged
merged 6 commits into from
Dec 11, 2022

Conversation

matmair
Copy link
Contributor

@matmair matmair commented Nov 24, 2022

This PR adds the option to use the static backend to write the lock file. Exactly like DefaultStorageBackend but using the storage set for static.

@codecov
Copy link

codecov bot commented Nov 24, 2022

Codecov Report

Base: 97.63% // Head: 97.71% // Increases project coverage by +0.08% 🎉

Coverage data is based on head (f3c05bf) compared to base (0a3fb96).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #97      +/-   ##
==========================================
+ Coverage   97.63%   97.71%   +0.08%     
==========================================
  Files          15       15              
  Lines         422      437      +15     
==========================================
+ Hits          412      427      +15     
  Misses         10       10              
Flag Coverage Δ
unittests 97.71% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
maintenance_mode/backends.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -48,6 +48,10 @@ MAINTENANCE_MODE_STATE_BACKEND = "maintenance_mode.backends.LocalFileBackend"

# alternatively it is possible to use the default storage backend
MAINTENANCE_MODE_STATE_BACKEND = "maintenance_mode.backends.DefaultStorageBackend"

# alternatively it is possible to use the static storage backend
# make sure that STATIC_ROOT and SATIC_URL are also set
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: SATIC_URL -> STATIC_URL


def get_value(self):
filename = settings.MAINTENANCE_MODE_STATE_FILE_NAME
try:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you check if the file exists before trying to open it?

@fabiocaccamo
Copy link
Owner

@matmair any update?

@fabiocaccamo fabiocaccamo added the enhancement New feature or request label Dec 1, 2022
@fabiocaccamo fabiocaccamo removed their assignment Dec 1, 2022
@fabiocaccamo fabiocaccamo merged commit 49fface into fabiocaccamo:master Dec 11, 2022
@fabiocaccamo
Copy link
Owner

@matmair thank you for this PR, it's included in 0.18.0 version.

@matmair matmair deleted the add-static-backend branch January 5, 2023 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants