已经可以顺利运行

This commit is contained in:
2025-11-06 10:55:39 +08:00
parent 48c3b0a798
commit 63cd095f1b
5 changed files with 78 additions and 49 deletions

View File

@@ -1,18 +1,21 @@
# README
# PWF
Plugin-based Web Framework
## Clone
use recursive
add as submodule
```bash
git clone --recursive <repository_url>
git init
git submodule add <repository_url> PWF
```
or
```bash
git clone <repository_url>
cd Convention
git clone <repository_url> PWF
cd PWF/Convention
git submodule update --init --recursive
```
@@ -22,6 +25,8 @@ use
```bash
python app.py
# from PWF.Application.app import main
# main()
```
to start and generate **Assets** Folder(generate by [ProjectConfig](Convention/Runtime/GlobalConfig.py))
@@ -38,7 +43,6 @@ just because program not running to the place where argument been referenced
### Commandline and Config
- **--main-webhook-url** main target of the message will be send, **needed**
- **--host** default: 0.0.0.0
- **--port** default: 8000
- **--verbose** default: false
@@ -46,7 +50,7 @@ just because program not running to the place where argument been referenced
### Only Config
- **max_concurrent_requests** default: 100
- **database_path** file on [Assets](Assets), default: db.db
- **database_path** file on Assets, default: db.db
- **plugin_dir** where plugins load, default: Plugins
- **always_return_ok** default: true
@@ -58,13 +62,11 @@ from CoreModules.plugin_interface import PluginInterface, DatabaseModel
class MyPlugin(PluginInterface):
def generate_router_callback(self):
"""生成路由回调函数,必需实现"""
async def callback():
return {"message": "Hello from MyPlugin"}
return callback
def register_db_model(self):
"""注册数据库模型,可选实现"""
return DatabaseModel(
table_name="my_plugin_table",
column_names=["id", "data", "created_at"],
@@ -76,10 +78,8 @@ class MyPlugin(PluginInterface):
)
def dependencies(self):
"""定义依赖的插件类,可选实现"""
return [] # 返回空列表表示无依赖
return []
def wake_up(self):
"""依赖插件注册完成后调用,可选实现"""
pass
```