Painless Django Deployments

Instead of constantly changing 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
    SITE_URL = 'http://localhost:8000'
    DEBUG = True
    ENV = 'DEBUG'

Leave a comment

Your email address will not be published. Required fields are marked *