flask 开发测试生产环境配置

class Config:
SECRET_KEY = ‘secret_key’
SQLALCHEMY_TRACK_MODIFICATIONS = False
# SQLALCHEMY_COMMIT_ON_TEARDOWN = True #设置自动提交

#开发环境
class DevelopmentConfig(Config):
SQLALCHEMY_DATABASE_URI = ‘mysql+pymysql://root:[email protected]:3306/python1807’
DEBUG = True

#测试环境
class TestingConfig(Config):
SQLALCHEMY_DATABASE_URI = ‘mysql+pymysql://root:[email protected]:3306/test_blog’
DEBUG = False

#生产环境
class ProductionConfig(Config):
SQLALCHEMY_DATABASE_URI = ‘mysql+pymysql://root:[email protected]:3306/blog’
DEBUG = False

#配置的字典
configDict = {
‘default’:DevelopmentConfig,
‘development’:DevelopmentConfig,
‘testing’:TestingConfig,
‘production’:ProductionConfig
}

你可能感兴趣的:(自我学习)