Skip to content

Commit fddd8d8

Browse files
Merge pull request #714 from OpenUpSA/bug-719-error-reading-from-s3
Set S3_URL_PREFIX to link to bulk downloads
2 parents 85f088d + 178405c commit fddd8d8

15 files changed

+19
-16
lines changed

municipal_finance/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,14 @@
456456
AWS_ACCESS_KEY_ID = env.str("AWS_ACCESS_KEY_ID", "")
457457
AWS_SECRET_ACCESS_KEY = env.str("AWS_SECRET_ACCESS_KEY", "")
458458
AWS_STORAGE_BUCKET_NAME = env.str("AWS_STORAGE_BUCKET_NAME", "")
459-
AWS_S3_CUSTOM_DOMAIN = "%s.s3.amazonaws.com" % AWS_STORAGE_BUCKET_NAME
459+
AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com"
460460
AWS_S3_OBJECT_PARAMETERS = {
461461
"CacheControl": "max-age=86400",
462462
}
463463
AWS_S3_ENDPOINT_URL = env.str("AWS_S3_ENDPOINT_URL", None)
464464
AWS_DEFAULT_ACL = "public-read"
465465
AWS_BUCKET_ACL = "public-read"
466+
AWS_REGION = env.str("AWS_REGION", "eu-west-1")
466467
UPDATE_BULK_DOWNLOADS = env.str("UPDATE_BULK_DOWNLOADS", False)
467468
BULK_DOWNLOAD_DIR = env.str("BULK_DOWNLOAD_DIR", "")
468469

municipal_finance/storage.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from storages.backends.s3boto3 import S3Boto3Storage
2+
from municipal_finance import settings
23

34

45
class MediaStorage(S3Boto3Storage):
56
location = "media"
67
file_overwrite = False
8+
region_name = settings.AWS_REGION

municipal_finance/update/aged_creditor_facts_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,6 @@ def row_to_obj(self, row):
8585
)
8686

8787

88-
def update_aged_creditor_facts_v2(update_obj, batch_size):
88+
def update_aged_creditor_facts_v2(update_obj, batch_size, **kwargs):
8989
updater = AgedCreditorFactsUpdater(update_obj, batch_size)
9090
updater.update()

municipal_finance/update/audit_opinion_facts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ def row_to_obj(self, row):
5252
)
5353

5454

55-
def update_audit_opinion_facts(update_obj, batch_size):
55+
def update_audit_opinion_facts(update_obj, batch_size, **kwargs):
5656
updater = AuditOpinionFactsUpdater(update_obj, batch_size)
5757
updater.update()

municipal_finance/update/capital_facts_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ def row_to_obj(self, row):
8080
)
8181

8282

83-
def update_capital_facts_v2(update_obj, batch_size):
83+
def update_capital_facts_v2(update_obj, batch_size, **kwargs):
8484
updater = CapitalFactsV2Updater(update_obj, batch_size)
8585
updater.update()

municipal_finance/update/cash_flow_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ def row_to_obj(self, row: CashFlowFactRow):
7575
)
7676

7777

78-
def update_cash_flow_v2(update_obj, batch_size):
78+
def update_cash_flow_v2(update_obj, batch_size, **kwargs):
7979
updater = CashFlowFactsV2Updater(update_obj, batch_size)
8080
updater.update()

municipal_finance/update/financial_position_facts_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ def row_to_obj(self, row):
7070
)
7171

7272

73-
def update_financial_position_facts_v2(update_obj, batch_size):
73+
def update_financial_position_facts_v2(update_obj, batch_size, **kwargs):
7474
updater = FinancialPositionFactsUpdater(update_obj, batch_size)
7575
updater.update()

municipal_finance/update/grant_facts_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ def row_to_obj(self, row):
7070
)
7171

7272

73-
def update_grant_facts_v2(update_obj, batch_size):
73+
def update_grant_facts_v2(update_obj, batch_size, **kwargs):
7474
updater = GrantFactsUpdater(update_obj, batch_size)
7575
updater.update()

municipal_finance/update/income_expenditure_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def row_to_obj(self, row: IncomeExpenditureFactRow):
7979
)
8080

8181

82-
def update_income_expenditure_v2(update_obj, batch_size):
82+
def update_income_expenditure_v2(update_obj, batch_size, **kwargs):
8383
updater = IncomeExpenditureFactsV2Updater(
8484
update_obj, batch_size,
8585
)

municipal_finance/update/municipal_staff_contacts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ def row_to_obj(self, row: MunicipalStaffContactRow):
5858
)
5959

6060

61-
def update_municipal_staff_contacts(update_obj, batch_size):
61+
def update_municipal_staff_contacts(update_obj, batch_size, **kwargs):
6262
updater = MunicipalStaffContactsUpdater(update_obj, batch_size)
6363
updater.update()

0 commit comments

Comments
 (0)