modify 更换orm框架
This commit is contained in:
@@ -3,32 +3,30 @@ app.name = "{{ cookiecutter.project_name }}"
|
||||
app.version = "{{ cookiecutter.project_name }}"
|
||||
app.description = "基于 FastAPI 和 Tortoise-ORM 的 chongming 打包脚手架"
|
||||
app.debug = false
|
||||
# env = "production"
|
||||
env = "development"
|
||||
|
||||
[database]
|
||||
type = "sqlite"
|
||||
url = "sqlite+aiosqlite:///./database.db"
|
||||
generate_schemas = true # 生产环境使用迁移工具
|
||||
|
||||
[database.sqlite]
|
||||
engine = "tortoise.backends.sqlite"
|
||||
file_path = "db.sqlite3"
|
||||
journal_mode = "WAL"
|
||||
busy_timeout = 10000
|
||||
maxsize = 10
|
||||
minsize = 1
|
||||
cache_size = -2000
|
||||
synchronous = "NORMAL"
|
||||
temp_store = "MEMORY"
|
||||
mmap_size = 1073741824
|
||||
foreign_keys = true
|
||||
auto_vacuum = "INCREMENTAL"
|
||||
max_cached_statements = 100
|
||||
readonly = false
|
||||
echo = true
|
||||
pool_size = 20
|
||||
max_overflow = 10
|
||||
pool_timeout = 30
|
||||
pool_recycle = 300
|
||||
pool_pre_ping = true
|
||||
connect_args.timeout = 15
|
||||
connect_args.check_same_thread = false
|
||||
|
||||
[security]
|
||||
secret_key = "your-secret-key-change-in-production"
|
||||
algorithm = "HS256"
|
||||
access_token_expire_minutes = 30
|
||||
refresh_token_expire_days = 7
|
||||
jwt_cache_db_path = "jwt_cache"
|
||||
max_sessions_per_user = 5
|
||||
|
||||
[development]
|
||||
env = "development"
|
||||
@@ -38,11 +36,11 @@ debug = true
|
||||
host = "127.0.0.1"
|
||||
port = 8000
|
||||
reload = true
|
||||
# workers = 4
|
||||
|
||||
[development.logging]
|
||||
level = "DEBUG"
|
||||
file = "logs/dev.log"
|
||||
format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
|
||||
[development.cors]
|
||||
allow_origins = ["*"]
|
||||
@@ -58,14 +56,17 @@ debug = false
|
||||
host = "0.0.0.0"
|
||||
port = 8000
|
||||
reload = false
|
||||
workers = 1
|
||||
workers = 4
|
||||
|
||||
[production.logging]
|
||||
level = "INFO"
|
||||
file = "logs/prod.log"
|
||||
format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
max_size = 10485760 # 10MB
|
||||
backup_count = 5 # 最多保存 10 个日志文件
|
||||
|
||||
[production.cors]
|
||||
allow_origins = ["https://yourdomain.com", "http://localhos:8000", "http://127.0.0.1:8000"]
|
||||
allow_origins = ["https://yourdomain.com", "http://localhost:8000", "http://127.0.0.1:8000"]
|
||||
allow_credentials = true
|
||||
allow_methods = ["GET", "POST", "PUT", "DELETE"]
|
||||
allow_headers = ["Authorization", "Content-Type"]
|
||||
@@ -77,6 +78,3 @@ path = ["resources/app.mbank", "resources/plugins.mbank"]
|
||||
[production.file_system]
|
||||
type = "svfs"
|
||||
path = "resources/application.vfs"
|
||||
|
||||
[cache]
|
||||
default_ttl = 300
|
||||
|
||||
Reference in New Issue
Block a user