上传文件至 /

This commit is contained in:
wangwei 2024-10-14 14:12:02 +08:00
commit 706f6f5776
2 changed files with 31 additions and 0 deletions

12
config.py Normal file
View File

@ -0,0 +1,12 @@
import os
from datetime import timedelta
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:Asdf123!@localhost/system'
SQLALCHEMY_TRACK_MODIFICATIONS = False
# JWT 配置
JWT_SECRET_KEY = 'your-secret-key' # 在生产环境中使用更安全的密钥
JWT_ACCESS_TOKEN_EXPIRES = timedelta(hours=1)
JWT_REFRESH_TOKEN_EXPIRES = timedelta(days=30)

19
run.py Normal file
View File

@ -0,0 +1,19 @@
from app import create_app, db
from app.models import User, Role, Permission, Department, RoleField # 添加所有你的模型
import logging
app = create_app()
if __name__ == '__main__':
# 设置控制台日志
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
console_handler.setFormatter(formatter)
app.logger.addHandler(console_handler)
app.run(debug=True)
@app.shell_context_processor
def make_shell_context():
return {'db': db, 'User': User, 'Role': Role, 'Permission': Permission, 'Department': Department, 'RoleField': RoleField}