代码拉取完成,页面将自动刷新
import os
from datetime import timedelta
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
# Change the secret key in production run.
SECRET_KEY = os.environ.get("SECRET_KEY", os.urandom(24))
DEBUG = False
#DRIVER = 'pymysql'
# JWT Extended config
JWT_SECRET_KEY = os.environ.get("JWT_SECRET_KEY", os.urandom(24))
## Set the token to expire every week
JWT_ACCESS_TOKEN_EXPIRES = timedelta(days=7)
# 异常处理
PROPAGATE_EXCEPTIONS = True
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get(
"DATABASE_URL", "sqlite:///" + os.path.join(basedir, "data-dev.sqlite")
)
SQLALCHEMY_TRACK_MODIFICATIONS = False
# Add logger
class TestingConfig(Config):
DEBUG = True
TESTING = True
# In-memory SQLite for testing
SQLALCHEMY_DATABASE_URI = "sqlite:///:memory:"
PRESERVE_CONTEXT_ON_EXCEPTION = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
class ProductionConfig(Config):
DEBUG = False
SQLALCHEMY_DATABASE_URI = os.environ.get(
"DATABASE_URL", "sqlite:///" + os.path.join(basedir, "data.sqlite")
)
SQLALCHEMY_TRACK_MODIFICATIONS = False
config_by_name = dict(
development=DevelopmentConfig,
testing=TestingConfig,
production=ProductionConfig,
default=DevelopmentConfig,
)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。