1 Star 0 Fork 58

alex / xnote

forked from xupingmao / xnote 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
architecture.md 2.21 KB
一键复制 编辑 原始数据 按行查看 历史

系统架构

目录结构

代码结构
|-- static/         # 静态文件
|-- handlers/       # http请求处理器目录,功能实现大部分在这里
|   |-- api/        # 系统接口,返回JSON格式,供页面、定时任务、搜索调用
|   |-- system/     # 系统功能目录
|   |-- note/       # 笔记功能目录
|   |-- fs/         # 文件功能目录
|   |-- tools/      # 工具目录
|   |-- plugins/    # 插件目录
|   |-- ...         # 其他目录
|-- tests/          # 测试用例
|-- xutils/         # 工具类集合
|-- lib/            # 第三方类库,程序启动时添加到sys.path中
|-- lang/           # 多语言配置
|-- app.py          # 程序入口
|-- xconfig.py      # 程序配置
|-- xmanager.py     # handlers管理器,负责模块加载,注册URL,以及定时任务触发
|-- xauth.py        # 权限控制
|-- xtables.py      # 数据库表结构
|-- xtemplate.py    # view层的渲染接口   
|-- autoreload.py   # 脚本变更热加载,主要用于调试,生产环境可以关闭


数据区结构
|-- files/     # 上传的文件
|-- backup/    # 备份目录
|-- scripts/   # 脚本目录
|-- storage/   # 其他存储目录(主要是缓存)
|-- tmp/       # 临时文件
|-- trash/     # 回收站

层次架构

架构图

开发框架/软件库

具体版本见requirements.txt

  • webpy(修改版,xnote内置)
  • tornado template(修改版,xnote内置)
  • sqlite3 (Python自带文件型数据库)
  • psutil(可选,采集系统运行数据)
  • comtypes(可选,用于调用微软语音API)

前端依赖

  • jquery 无须解释
  • layer web弹层组件
  • marked(markdown解析器)
  • qrcode 二维码生成器
  • csv.js 解析csv文件
  • jsdiff 文本对比
  • codemirror 代码编辑器
  • jexcel web表格

新模块开发

在handlers目录下添加python程序,比如test.py

class handler:    
    def GET(self):
        return "success"
# 如果配置了xurls全局变量,xnote会注册指定的url pattern否则按照相对handlers的路径注册
xurls = (
    r"/test", handler
)
# 启动xnote,访问浏览器localhost:1234/test就会看到success
Python
1
https://gitee.com/XX_moonlight/xnote.git
git@gitee.com:XX_moonlight/xnote.git
XX_moonlight
xnote
xnote
master

搜索帮助