import os

class Config:
    #配置Mysql参数
    MYSQL_DIALECT = 'mysql'
    MYSQL_DRIVER = 'pymysql'
    MYSQL_NAME = 'root'
    MYSQL_PWD = 'root'
    MYSQL_HOST = 'localhost'
    MYSQL_PORT = 3306
    MYSQL_DB = 'flask_shop'
    MYSQL_CHARSET = 'utf8mb4'

    SQLALCHEMY_DATABASE_URI = f'{MYSQL_DIALECT}+{MYSQL_DRIVER}://{MYSQL_NAME}:{MYSQL_PWD}@{MYSQL_HOST}:{MYSQL_PORT}/{MYSQL_DB}?charset = {MYSQL_CHARSET}'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    SECRET_KEY = os.urandom(16)

class DevelopmentConfig(Config):
    DEBUG = True

class ProductConfig(Config):
    pass

config_map = {
    'develop':DevelopmentConfig,
    'product':ProductConfig
}