Ticket #2858: hostname.diff

File hostname.diff, 1.2 KB (added by Fraser Nevett <mail@…>, 18 years ago)
  • global_settings.py

     
    11# Default Django settings. Override these with settings in the module
    22# pointed-to by the DJANGO_SETTINGS_MODULE environment variable.
    33
     4import socket
     5
    46# This is defined here as a do-nothing function because we can't import
    57# django.utils.translation -- that module depends on the settings.
    68gettext_noop = lambda s: s
     
    8890DEFAULT_CHARSET = 'utf-8'
    8991
    9092# E-mail address that error messages come from.
    91 SERVER_EMAIL = 'root@localhost'
     93try:
     94    SERVER_EMAIL = 'root@%s' % socket.gethostname()
     95except:
     96    SERVER_EMAIL = 'root@localhost'
    9297
    9398# Whether to send broken-link e-mails.
    9499SEND_BROKEN_LINK_EMAILS = False
     
    146151
    147152# Default e-mail address to use for various automated correspondence from
    148153# the site managers.
    149 DEFAULT_FROM_EMAIL = 'webmaster@localhost'
     154try:
     155    DEFAULT_FROM_EMAIL = 'webmaster@%s' % socket.gethostname()
     156except:
     157    DEFAULT_FROM_EMAIL = 'webmaster@localhost'
    150158
    151159# Subject-line prefix for email messages send with django.core.mail.mail_admins
    152160# or ...mail_managers.  Make sure to include the trailing space.
Back to Top