diff --git a/{{ cookiecutter.project_name }}/README.md b/{{ cookiecutter.project_name }}/README.md index 30b0015..b807ff1 100644 --- a/{{ cookiecutter.project_name }}/README.md +++ b/{{ cookiecutter.project_name }}/README.md @@ -42,3 +42,9 @@ build ├── config.toml └── {{ cookiecutter.project_name }} # windows {{ cookiecutter.project_name }}.exe ``` + +运行打包后的项目 +```shell +cd build +{{ cookiecutter.project_name }} # windows {{ cookiecutter.project_name }}.exe +``` diff --git a/{{ cookiecutter.project_name }}/public/config.toml b/{{ cookiecutter.project_name }}/public/config.toml new file mode 100644 index 0000000..90a0b09 --- /dev/null +++ b/{{ cookiecutter.project_name }}/public/config.toml @@ -0,0 +1,86 @@ +[default] +app.name = "{{ cookiecutter.project_name }}" +app.version = "{{ cookiecutter.author_name }}" +app.description = "基于 FastAPI 和 Tortoise-ORM 的 chongming 打包脚手架" +app.debug = false +env = "production" + +[server] +host = "0.0.0.0" +port = 8000 +reload = false +workers = 4 + +[database] +url = "sqlite://db.sqlite3" +# PostgreSQL 示例: "postgres://user:pass@localhost:5432/dbname" +# MySQL 示例: "mysql://user:pass@localhost:3306/dbname" +generate_schemas = true # 生产环境使用迁移工具 + +[security] +secret_key = "your-secret-key-change-in-production" +algorithm = "HS256" +access_token_expire_minutes = 30 + +[development] +env = "development" +debug = true + +[development.server] +host = "127.0.0.1" +port = 8000 +reload = true +# workers = 4 + +[development.database] +url = "sqlite://dev.db" +generate_schemas = true + +[development.logging] +level = "DEBUG" +file = "logs/dev.log" + +[development.cors] +allow_origins = ["*"] +allow_credentials = true +allow_methods = ["*"] +allow_headers = ["*"] + +[production] +env = "production" +debug = false + +[production.server] +host = "0.0.0.0" +port = 8000 +reload = false +workers = 1 + +[production.database] +url = "sqlite://prod.db" +generate_schemas = true + +[production.logging] +level = "INFO" +file = "logs/prod.log" + +[production.cors] +allow_origins = ["https://yourdomain.com"] +allow_credentials = true +allow_methods = ["GET", "POST", "PUT", "DELETE"] +allow_headers = ["Authorization", "Content-Type"] + +[production.module_system] +type = "module-bank" +path = ["resources/app.mbank", "resources/plugins.mbank"] + +[production.file_system] +type = "svfs" +path = "resources/application.vfs" + +[redis] +enabled = false +url = "redis://localhost:6379" + +[cache] +default_ttl = 300 \ No newline at end of file diff --git a/{{ cookiecutter.project_name }}/src/{{ cookiecutter.project_name }}/scripts/build.py b/{{ cookiecutter.project_name }}/src/{{ cookiecutter.project_name }}/scripts/build.py index f606f17..e950285 100644 --- a/{{ cookiecutter.project_name }}/src/{{ cookiecutter.project_name }}/scripts/build.py +++ b/{{ cookiecutter.project_name }}/src/{{ cookiecutter.project_name }}/scripts/build.py @@ -107,7 +107,7 @@ def main(): # 复制 main.py 到 build 文件夹 shutil.copy("public/main.py", "build") # 复制 config.toml 到 build 文件夹 - shutil.copy("config.toml", "build") + shutil.copy("public/config.toml", "build") # 复制 utils 文件夹到 build 文件夹 shutil.copytree("public/utils", "build/utils")