Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app = Flask(
- __name__,
- static_folder="./client/dist",
- template_folder="./" + client_build_dir, # type: ignore
- ) # type: Flask
- app.session_interface = SecureCookieSession()
- config_map = {
- DEVELOPMENT: LocalConfig,
- TESTING: TestingConfig,
- STAGING: StagingConfig,
- PRODUCTION: ProductionConfig,
- }
- config = config_map[app.env] # type: ignore
- app.config.from_object(config)
- def _get_logger(log_level: str) -> logging.Logger:
- logging.basicConfig(
- level=log_level, format="%(asctime)s - %(levelname)s - %(message)s"
- )
- logger = logging.getLogger(__name__)
- return logger
- logger = _get_logger(config.LOG_LEVEL) # type: logging.Logger
- ####################### TestingConfig object used by testing environment
- class Config(object):
- SQLALCHEMY_DATABASE_URI = os.getenv("DATABASE_URL")
- DEBUG = False
- TESTING = False
- LOG_LEVEL = "INFO"
- # ...
- class TestingConfig(Config):
- ENV = "testing"
- TESTING = True
- DEBUG = True
- LOG_LEVEL = "DEBUG"
- SQLALCHEMY_DATABASE_URI = TEST_SQLALCHEMY_DATABASE_URI
- WEB_APP_DOMAIN = "http://localhost:5000/web"
- WEB_APP_SERVER = "http://localhost:5000"
Advertisement
Add Comment
Please, Sign In to add comment