You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

  1. import os
  2. basedir = os.path.abspath(os.path.dirname(__file__))
  3. class Config:
  4. SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
  5. MAIL_SERVER = os.environ.get('MAIL_SERVER', 'smtp.strato.de')
  6. MAIL_PORT = int(os.environ.get('MAIL_PORT', '587'))
  7. MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS', 'true').lower() in \
  8. ['true', 'on', '1']
  9. MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
  10. MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
  11. FLASKY_MAIL_SUBJECT_PREFIX = '[Flasky]'
  12. FLASKY_MAIL_SENDER = 'Flasky Admin <flasky@example.com>'
  13. FLASKY_ADMIN = os.environ.get('FLASKY_ADMIN')
  14. SQLALCHEMY_TRACK_MODIFICATIONS = False
  15. @staticmethod
  16. def init_app(app):
  17. pass
  18. class DevelopmentConfig(Config):
  19. DEBUG = True
  20. SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or \
  21. 'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
  22. class TestingConfig(Config):
  23. TESTING = True
  24. SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or \
  25. 'sqlite://'
  26. class ProductionConfig(Config):
  27. SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
  28. 'sqlite:///' + os.path.join(basedir, 'data.sqlite')
  29. config = {
  30. 'development': DevelopmentConfig,
  31. 'testing': TestingConfig,
  32. 'production': ProductionConfig,
  33. 'default': DevelopmentConfig
  34. }