This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compress_image(image): | |
# Define your compression settings here | |
# For example, you can resize the image and adjust the quality | |
max_size = (800, 800) | |
quality = 80 | |
# Resize the image while preserving aspect ratio | |
image.thumbnail(max_size, Image.ANTIALIAS) | |
# Convert the image to RGB mode (necessary for saving as JPEG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGING = { | |
# ... (other logging configurations) | |
'handlers': { | |
'mail_admins': { | |
'level': 'ERROR', | |
'class': 'django.utils.log.AdminEmailHandler', | |
'include_html': True, | |
}, | |
}, | |
# ... (loggers, filters, and formatters) |
OlderNewer