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

UAT / Prod release #2848

Merged
merged 10 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,16 @@
str(ROOT_DIR / 'sso_profile' / 'static'),
]

STATICFILES_STORAGE = env.str('STATICFILES_STORAGE', 'whitenoise.storage.CompressedStaticFilesStorage')
DEFAULT_FILE_STORAGE = env.str('DEFAULT_FILE_STORAGE', 'storages.backends.s3boto3.S3Boto3Storage')

STORAGES = {
'default': {
'BACKEND': env.str('DEFAULT_FILE_STORAGE', 'storages.backends.s3boto3.S3Boto3Storage'),
},
'staticfiles': {
'BACKEND': env.str('STATICFILES_STORAGE', 'whitenoise.storage.CompressedStaticFilesStorage'),
},
}


STATIC_ROOT = str(ROOT_DIR / 'staticfiles')
STATIC_URL = '/static/'
Expand Down Expand Up @@ -408,7 +416,8 @@
AWS_QUERYSTRING_AUTH = env.bool('AWS_QUERYSTRING_AUTH', False)
S3_USE_SIGV4 = env.bool('S3_USE_SIGV4', True)

USER_MEDIA_ON_S3 = DEFAULT_FILE_STORAGE == 'storages.backends.s3boto3.S3Boto3Storage'
USER_MEDIA_ON_S3 = STORAGES['default']['BACKEND'] == 'storages.backends.s3boto3.S3Boto3Storage'

# Wagtail-Transfer needs MEDIA_URL set to reference cloud storage
if USER_MEDIA_ON_S3 and (AWS_STORAGE_BUCKET_NAME or AWS_S3_CUSTOM_DOMAIN):
if AWS_S3_CUSTOM_DOMAIN: # eg cdn.example.com
Expand Down
10 changes: 5 additions & 5 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Django
# ------------
django==4.1.13
django==4.2
django-environ==0.4.*
django-redis==5.2.*
django-redis==5.4.0
django_storages[boto3]==1.13.2
django-extensions==3.2.3
django-ipware==2.1.*
Expand Down Expand Up @@ -32,9 +32,9 @@ sentry-sdk==1.14.*

# DIT packages
# ------------
great-components==2.5.0
directory-constants==23.1
directory-healthcheck==3.1.2
great-components==2.5.1
directory-constants==23.1.1
directory-healthcheck==3.2
directory-validators==9.3.0
directory-components==39.1.2
directory-api-client==26.4.2
Expand Down
29 changes: 10 additions & 19 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,20 @@ directory-client-core==7.2.8
# directory-sso-api-client
directory-components==39.1.2
# via -r requirements.in
directory-constants==23.1.0
directory-constants==23.1.1
# via
# -r requirements.in
# directory-components
# great-components
directory-forms-api-client==7.3.1
# via -r requirements.in
directory-healthcheck==3.1.2
directory-healthcheck==3.2
# via -r requirements.in
directory-sso-api-client==7.2.3
# via -r requirements.in
directory-validators==9.3.0
# via -r requirements.in
django==4.1.13
django==4.2
# via
# -r requirements.in
# directory-api-client
Expand Down Expand Up @@ -174,7 +174,7 @@ django-permissionedforms==0.1
# via wagtail
django-recaptcha==3.0.0
# via -r requirements.in
django-redis==5.2.0
django-redis==5.4.0
# via -r requirements.in
django-staff-sso-client==4.2.0
# via -r requirements.in
Expand Down Expand Up @@ -216,17 +216,13 @@ factory-boy==3.3.0
# via
# -r requirements.in
# wagtail-factories
faker==22.2.0
faker==22.4.0
# via factory-boy
filetype==1.2.0
# via willow
freetype-py==2.3.0
# via
# reportlab
# rlpycairo
geoip2==2.9.0
# via -r requirements.in
great-components==2.5.0
great-components==2.5.1
# via -r requirements.in
gunicorn==20.1.0
# via -r requirements.in
Expand Down Expand Up @@ -270,7 +266,7 @@ markdown2==2.4.0
# via
# -r requirements.in
# readtime
markupsafe==2.1.3
markupsafe==2.1.4
# via jinja2
maxminddb==2.5.2
# via geoip2
Expand Down Expand Up @@ -312,8 +308,6 @@ prompt-toolkit==3.0.43
# via click-repl
psycopg2==2.9.9
# via -r requirements.in
pycairo==1.25.1
# via rlpycairo
pycparser==2.21
# via cffi
pygments==2.17.2
Expand All @@ -324,7 +318,7 @@ pyhanko-certvalidator==0.26.3
# via
# pyhanko
# xhtml2pdf
pypdf==3.17.4
pypdf==4.0.0
# via xhtml2pdf
pypng==0.20220715.0
# via qrcode
Expand Down Expand Up @@ -371,9 +365,8 @@ redis==5.0.1
# django-redis
regex==2023.12.25
# via dateparser
reportlab[pycairo]==4.0.9
reportlab==4.0.9
# via
# reportlab
# svglib
# xhtml2pdf
requests==2.31.0
Expand All @@ -390,8 +383,6 @@ requests==2.31.0
# wagtail
requests-oauthlib==1.3.1
# via django-staff-sso-client
rlpycairo==0.3.0
# via reportlab
s3transfer==0.6.2
# via boto3
sentry-sdk==1.14.0
Expand Down Expand Up @@ -510,7 +501,7 @@ willow[heif]==1.6.3
# via
# wagtail
# willow
xhtml2pdf==0.2.13
xhtml2pdf==0.2.14
# via -r requirements.in

# The following packages are considered to be unsafe in a requirements file:
Expand Down
33 changes: 12 additions & 21 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,22 @@ directory-client-core==7.2.8
# directory-sso-api-client
directory-components==39.1.2
# via -r requirements.in
directory-constants==23.1.0
directory-constants==23.1.1
# via
# -r requirements.in
# directory-components
# great-components
directory-forms-api-client==7.3.1
# via -r requirements.in
directory-healthcheck==3.1.2
directory-healthcheck==3.2
# via -r requirements.in
directory-sso-api-client==7.2.3
# via -r requirements.in
directory-validators==9.3.0
# via -r requirements.in
distlib==0.3.8
# via virtualenv
django==4.1.13
django==4.2
# via
# -r requirements.in
# directory-api-client
Expand Down Expand Up @@ -235,7 +235,7 @@ django-permissionedforms==0.1
# via wagtail
django-recaptcha==3.0.0
# via -r requirements.in
django-redis==5.2.0
django-redis==5.4.0
# via -r requirements.in
django-staff-sso-client==4.2.0
# via -r requirements.in
Expand Down Expand Up @@ -293,7 +293,7 @@ factory-boy==3.3.0
# via
# -r requirements.in
# wagtail-factories
faker==22.2.0
faker==22.4.0
# via factory-boy
filelock==3.13.1
# via virtualenv
Expand All @@ -317,7 +317,7 @@ flake8-quotes==3.3.2
# via -r requirements_test.in
flake8-string-format==0.3.0
# via -r requirements_test.in
flask==3.0.0
flask==3.0.1
# via
# -r requirements_test.in
# flask-basicauth
Expand All @@ -327,10 +327,6 @@ flask-basicauth==0.2.0
# via locust
flask-cors==4.0.0
# via locust
freetype-py==2.3.0
# via
# reportlab
# rlpycairo
freezegun==1.1.0
# via -r requirements_test.in
geoip2==2.9.0
Expand All @@ -345,7 +341,7 @@ gitdb==4.0.11
# via gitpython
gitpython==3.1.41
# via -r requirements_test.in
great-components==2.5.0
great-components==2.5.1
# via -r requirements.in
greenlet==3.0.3
# via gevent
Expand Down Expand Up @@ -429,7 +425,7 @@ markdown2==2.4.0
# via
# -r requirements.in
# readtime
markupsafe==2.1.3
markupsafe==2.1.4
# via
# jinja2
# werkzeug
Expand Down Expand Up @@ -520,7 +516,7 @@ prompt-toolkit==3.0.43
# via
# click-repl
# ipython
psutil==5.9.7
psutil==5.9.8
# via
# browserstack-local
# browserstack-sdk
Expand All @@ -531,8 +527,6 @@ ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.2
# via stack-data
pycairo==1.25.1
# via rlpycairo
pycodestyle==2.11.1
# via
# flake8
Expand Down Expand Up @@ -560,7 +554,7 @@ pylint-django==2.5.5
# via -r requirements_test.in
pylint-plugin-utils==0.8.2
# via pylint-django
pypdf==3.17.4
pypdf==4.0.0
# via xhtml2pdf
pypng==0.20220715.0
# via qrcode
Expand Down Expand Up @@ -642,9 +636,8 @@ regex==2023.12.25
# via
# dateparser
# djlint
reportlab[pycairo]==4.0.9
reportlab==4.0.9
# via
# reportlab
# svglib
# xhtml2pdf
requests==2.31.0
Expand All @@ -671,8 +664,6 @@ requests-oauthlib==1.3.1
# via django-staff-sso-client
requests-toolbelt==1.0.0
# via browserstack-sdk
rlpycairo==0.3.0
# via reportlab
roundrobin==0.0.4
# via locust
ruamel-yaml==0.18.5
Expand Down Expand Up @@ -862,7 +853,7 @@ willow[heif]==1.6.3
# willow
wsproto==1.2.0
# via trio-websocket
xhtml2pdf==0.2.13
xhtml2pdf==0.2.14
# via -r requirements.in
zipp==3.17.0
# via importlib-metadata
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/core/test_views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_companies_house_api_view(mock_get_company_profile, mock_search_companie


@pytest.mark.django_db
@override_settings(DEFAULT_FILE_STORAGE='storages.backends.s3boto3.S3Boto3Storage')
@override_settings(STORAGES={'default': {'BACKEND': 'storages.backends.s3boto3.S3Boto3Storage'}})
@mock.patch('storages.backends.s3boto3.S3Boto3Storage')
def test_signed_url_view(patch_storage, client):
patch_storage().connection.meta.client.generate_presigned_url.return_value = 'pre-signed-url'
Expand Down
Loading