config.py 695 B

1234567891011121314151617181920212223242526272829
  1. from flask.config import Config
  2. import os
  3. from dotenv import load_dotenv
  4. load_dotenv()
  5. START_YEAR = 2022
  6. SITE_TITLE = 'Агрегатор лекций ИСККОН'
  7. class DefaultConfig(Config):
  8. DEBUG = True
  9. PORT = int(os.environ["PORT"])
  10. HOST = os.environ["HOST"]
  11. DEVELOPMENT = True
  12. SECRET_KEY = 'do-i-really-need-this'
  13. FLASK_HTPASSWD_PATH = '/secret/.htpasswd'
  14. FLASK_SECRET = SECRET_KEY
  15. DB_HOST = 'database' # a docker link
  16. class ProductionConfig(DefaultConfig):
  17. DEVELOPMENT = False
  18. DEBUG = False
  19. DB_HOST = 'my.production.database' # not a docker link
  20. mode = os.environ["MODE"]
  21. config = ProductionConfig if mode == "prod" else DefaultConfig