It is difficult to know from which environment the mail was sent when running in various environments or when there are multiple application servers.
So send it with the host name in the subject of the email. Since the host name can be obtained with the socket module, send an email using this as a prefix.
socket
settings.py
from socket import gethostname
EMAIL_SUBJECT_PREFX = '[%s]' % gethostname()
os Or you can get it from uname of os module.
settings.py
import os
EMAIL_SUBJECT_PREFIX = '[%s]' % os.uname()[1]
platform Similarly in the platform module.
settings.py
import platform
EMAIL_SUBJECT_PREFIX = '[%s]' % platform.uname()[1]
Recommended Posts