Skip to content

Commit 548c544

Browse files
authored
Fix image uploads (#1612)
* downgrade boto * Update base.txt * reverting a few changes * add some logging for image uploads * remove load truncated images * fix N+1 * log all the things * pin django * lower log level * revert logging * formatting * remove commented code
1 parent 6c9cc93 commit 548c544

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

openstax/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def get_base_queryset(self):
7272
# Exclude pages that the user doesn't have access to
7373
restricted_pages = [
7474
restriction.page
75-
for restriction in PageViewRestriction.objects.all().select_related("page")
75+
for restriction in PageViewRestriction.objects.select_related("page")
7676
if not restriction.accept_request(self.request)
7777
]
7878

openstax/settings/base.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@
324324
'loggers': {
325325
# default for all undefined Python modules
326326
'': {
327-
'level': 'ERROR',
327+
'level': LOGLEVEL,
328328
'handlers': ['console'],
329329
},
330330
# Our application code
@@ -411,25 +411,24 @@
411411
WAGTAIL_REDIRECTS_FILE_STORAGE = 'cache'
412412
WAGTAILFORMS_HELP_TEXT_ALLOW_HTML = True
413413

414+
# Disable the workflow, we don't use them
415+
WAGTAIL_WORKFLOW_ENABLED = False
416+
414417
WAGTAILSEARCH_BACKENDS = {
415418
'default': {
416419
'BACKEND': 'wagtail.search.backends.database',
417420
}
418421
}
419422

420-
from PIL import ImageFile
421-
422-
ImageFile.LOAD_TRUNCATED_IMAGES = True
423-
424423
WAGTAILIMAGES_EXTENSIONS = ["gif", "jpg", "jpeg", "png", "webp", "svg"]
425424
WAGTAILIMAGES_FORMAT_CONVERSIONS = {
426425
'webp': 'webp',
427426
'jpeg': 'webp',
428427
'jpg': 'webp',
429428
'png': 'webp',
430429
}
431-
WAGTAILIMAGES_MAX_UPLOAD_SIZE = 4 * 1024 * 1024 # 4MB
432-
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10_240
430+
WAGTAILIMAGES_MAX_UPLOAD_SIZE = 20 * 1024 * 1024 # 20MB
431+
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240
433432

434433
WAGTAILADMIN_RICH_TEXT_EDITORS = {
435434
'default': {

requirements/base.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
boto3
22
botocore
33
bs4
4-
Django
4+
Django==5.0.12
55
certifi
66
django-admin-rangefilter
77
django-crontab
@@ -15,7 +15,7 @@ django-rest-auth
1515
django-reversion
1616
django-ses
1717
django-storages
18-
django-taggit>=5.0.0
18+
django-taggit>=6.1.0
1919
djangorestframework
2020
html2text # news feed
2121
mapbox

0 commit comments

Comments
 (0)