Skip to content

Instantly share code, notes, and snippets.

@javamo
Last active November 9, 2017 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javamo/2e1fd2bf920eb435334e07aea9a0462e to your computer and use it in GitHub Desktop.
Save javamo/2e1fd2bf920eb435334e07aea9a0462e to your computer and use it in GitHub Desktop.
app/config.py
from os import getenv
class Config:
SECRET_KEY = getenv('SECRET_KEY', 'hard to guess string')
PROPAGATE_EXCEPTIONS = True
SQLALCHEMY_ECHO = getenv('SQLALCHEMY_ECHO') == 'true'
SQLALCHEMY_DATABASE_URI = getenv('DATABASE_URL')
SQLALCHEMY_TRACK_MODIFICATIONS = True
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
class TestingConfig(DevelopmentConfig):
TESTING = True
class StagingConfig(Config):
SQLALCHEMY_TRACK_MODIFICATIONS = False
class ProductionConfig(Config):
SQLALCHEMY_TRACK_MODIFICATIONS = False
config = dict(
development=DevelopmentConfig,
testing=TestingConfig,
staging=StagingConfig,
production=ProductionConfig,
default=DevelopmentConfig
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment