Hacker News new | ask | show | jobs
by weirdcat 4849 days ago
I use a version of that -- a single system variable identifying the environment and a series of conditional blocks for each environment in the settings.py file:

  ENVIRONMENT = os.environ.get('ENVIRONMENT', None)
  
  if not ENVIRONMENT in ('development', 'staging', 'production'):
      raise Exception('You need to set ENVIRONMENT variable')
  
  if ENVIRONMENT == 'development':
      # ...
  elif ENVIRONMENT == 'staging':
      # ...