Painless Django Settings.py Deployments

Instead of constantly changing settings.py for different environment, automate the the process with some simple python:

import socket
ROOT = os.path.dirname(os.path.realpath(__file__)) # Use this wherever an absolute path is necessary.
if socket.gethostname().startswith('your_production_hostname'):
    SITE_URL = 'http://...'
    DEBUG = False
    ENV = 'PRODUCTION'
else:
    SITE_URL = 'http://localhost:8000'
    DEBUG = True
    ENV = 'DEBUG'