settings.py 304 B

123456789101112
  1. import configparser
  2. import os
  3. config = configparser.ConfigParser()
  4. if os.environ.get('APP_ENV', 'development') == 'development':
  5. config.readfp(open('development.ini'))
  6. elif os.environ.get('APP_ENV') == 'production':
  7. config.readfp(open('production.ini'))
  8. print(config.get('DATABASE', 'host'))