一款web协程框架
Project description
CheeseAPI
一款协程友好的 web 框架
该框架为个人设计,仅供学习交流使用,各种 API 目前不会保证稳定性和向后兼容性
安装
pip install CheeseAPI
依赖
日志系统,CheeseAPI 使用它进行日志的输出与记录
信号系统,CheeseAPI 使用它进行所有事件信号的管理与分发
项目结构
CheeseAPI采用模块结构:
| - User
| - __init__.py
| - model.py
| - api.py
| - scheduler.py
| - service.py
| - handle.py
| - validator.py
| - Permission
| - __init__.py
| - model.py
| - api.py
| - service.py
| - validator.py
| - __init__.py
| - app.py
CheeseAPI 并没有强制规定文件名,但建议的文件命名方式如下:
| 文件名 | 备注 |
|---|---|
| __init__.py | 公用变量 |
| model.py | ORM或类 |
| api.py | API接口 |
| scheduler.py | 定时任务 |
| service.py | 业务逻辑实现 |
| handle.py | 运行逻辑 |
| validator.py | 参数校验 |
使用
创建一个 app 文件 app.py:
from CheeseAPI import CheeseAPI, Response
app = CheeseAPI()
@app.route.get('/')
async def index(**kwargs):
return Response('这里是CheeseAPI!')
若在单文件中运行,继续添加入口即可
if __name__ == '__main__':
app.run()
若在多文件项目中运行,可创建一个 manage.py 入口文件
from app import app
if __name__ == '__main__':
app.run()
运行入口文件即可
示例
在 examples 目录下有一些示例项目,可以参考学习
文档
1. CheeseAPI(主模块)
2. Route(路由)
3. Request
4. Response
5. Websocket
6. File
7. Validator(数据校验)
8. Signal
9. Scheduler(任务调度)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cheeseapi-2.0.6b2.tar.gz
(27.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cheeseapi-2.0.6b2.tar.gz.
File metadata
- Download URL: cheeseapi-2.0.6b2.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53f7df4585f1f35993d4c92494b2d19964c93743b599393df4cd8daa025994c1
|
|
| MD5 |
858db5c612e32de498bb87bc5d523115
|
|
| BLAKE2b-256 |
9bf7c0b7ad118febeb34c3b601ee7569986d7210b63be4044a36dd6738e2653e
|
File details
Details for the file cheeseapi-2.0.6b2-py2.py3-none-any.whl.
File metadata
- Download URL: cheeseapi-2.0.6b2-py2.py3-none-any.whl
- Upload date:
- Size: 33.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2e5fdcd2feb8bae3258a26c21e7a371ec58363a70c02d36c0fede3c7b2fa084
|
|
| MD5 |
5220e9a17335e57b47c9474d6bd3cd8d
|
|
| BLAKE2b-256 |
9a3a814b9ce69b375648e2da20e7e66ccaa4314cd26210fdd0bfafcef4239459
|