config.py 578 B

12345678910111213141516171819202122
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @Contact : liuyuqi.gov@msn.cn
  5. @Time : 2024/07/29 13:48:28
  6. @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
  7. @Desc : config
  8. '''
  9. import os
  10. class Settings(object):
  11. """ settings for app """
  12. # read config from .env
  13. if not os.path.exists('.env'):
  14. raise Exception('please create.env file')
  15. with open('.env') as f:
  16. for line in f:
  17. if line.startswith('FLY_'):
  18. k, v = line.strip().split('=')
  19. os.environ[k] = v
  20. settings = Settings()