{"id":13625896,"url":"https://github.com/xiaowan/pyadmin","last_synced_at":"2025-04-16T10:33:38.594Z","repository":{"id":217073256,"uuid":"103640442","full_name":"xiaowan/pyadmin","owner":"xiaowan","description":"管理后台脚手架，实现了RBAC， 和一个简单的SQLALCHEMY的Mapper工具，基于tornado框架","archived":false,"fork":false,"pushed_at":"2024-01-30T04:13:06.000Z","size":930,"stargazers_count":135,"open_issues_count":1,"forks_count":46,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-08T15:46:21.513Z","etag":null,"topics":["python","tornado","vue-admin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiaowan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-15T09:36:58.000Z","updated_at":"2024-10-28T03:33:40.000Z","dependencies_parsed_at":"2024-01-14T12:29:37.522Z","dependency_job_id":"71ef20d2-92ae-4412-bb5c-29a96ac4c201","html_url":"https://github.com/xiaowan/pyadmin","commit_stats":null,"previous_names":["xiaowan/pyadmin"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaowan%2Fpyadmin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaowan%2Fpyadmin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaowan%2Fpyadmin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaowan%2Fpyadmin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiaowan","download_url":"https://codeload.github.com/xiaowan/pyadmin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249228273,"owners_count":21233852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","tornado","vue-admin"],"created_at":"2024-08-01T21:02:04.986Z","updated_at":"2025-04-16T10:33:38.315Z","avatar_url":"https://github.com/xiaowan.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\n**简介**\n\n该脚手架可快速为管理后台提供restful接口，框架前端使用 https://github.com/PanJiaChen/vue-element-admin  \n框架自带一个简单的RBAC以及web操作界面，web界面地址：https://github.com/xiaowan/pyadmin-ui  \n数据库表及部分数据在dbinfo 目录内  \n测试数据中包含三个用户，登陆名为root，developer，seven，分别对应 上帝视角，开发人员，普通员工三个系统角色  \n\n\n**要求python版本为3.5+，使用到的第三方库：**  \n - tornado 作为基础框架\n - oslo.config 作为配置管理\n - oslo.context 作为请求分配request id，如果以后收集日志至类似ELK环境中，可使用request id 来查询  \n - oslo.log 日志管理\n - sqlalchemy 作为mysql mapper\n - pika 操作rabbitmq\n - redis 操作redis，目前登陆token存放在redis中\n\n  \n\n**配置环境**\n\n此脚手架使用openstack的 oslo.config 作为配置管理，目前区分三个环境，分别是线上环境(conf)，开发环境(debug)，预览环境(pre)。 指定环境有三种方式：  \n\n - 项目启动时使用 --config-file=conf/xxx.ini 来读取指定配置。  \n - 设置 UNITYMOB_ENVIRON 环境变量，变量值分别为 conf, debug, pre ，分别对应上述三个环境。  \n - 如果不指定配置文件，也没有设置环境变量，则默认使用conf环境的配置。  \n如果同时设置了方式一和方式二，方式一的优先级级别最高。 \n\n**关于目录结构**\n\n个人更喜欢java工程目录接口，所以该脚手架很大一部分都借鉴了java工程，以下为脚手架目录结构  \n - controllers 请求地址与逻辑类映射 service\n - 业务逻辑层，被controller层调用\n - dao 细粒度的数据库增删改查\n - mapper 中每个文件为数据库表对应的文件\n - conf 存放所有配置文件。\n - library 目录为经常用到的库，以及常用中间件的简单封装，大致内容为：  \n\n\u0026nbsp;\u0026nbsp;Decoreate.py 常用装饰器  \n\u0026nbsp;\u0026nbsp;Exception.py 在这里自定义自己的异常，使用时只需在代码中抛出该异常即可。  \n\u0026nbsp;\u0026nbsp;G.py 这是一个单例类，常用的中间件都会放到此类中操作。  \n\u0026nbsp;\u0026nbsp;Handlers.py 业务层Handler，controllers中的具体操作类可根据具体情况继承该文件中的Handler。  \n\u0026nbsp;\u0026nbsp;MyRabbitmq.py rabbitmq 操作封装，尽可能使用一个rabbitmq连接，每个请求中使用一个单独的channel操作rabbitmq  \n\u0026nbsp;\u0026nbsp;MyRedis.py redis操作封装  \n\u0026nbsp;\u0026nbsp;Result.py restful请求返回结果封装  \n\u0026nbsp;\u0026nbsp;Route.py 负责管理所有的请求地址与逻辑处理类的映射\n\u0026nbsp;\u0026nbsp;RPCClient.py 暂时无用  \n\u0026nbsp;\u0026nbsp;Utils.py 常用工具类函数  \n\n**以下为常用装饰器：**  \n\n - DI 使用了python动态语言的特性，可以方便的为类新增类属性。\n - Singleton 单例模式\n - Transaction 需要使用事务的地方，函数执行结束会自动提交事务，如执行失败会上抛该函数异常，并且回滚事务。\n - Return controller层返回结果的封装，确保返回结果被放到了Result类中\n - Deprecated 已废弃方法如果代码没有及时删除，可使用该装饰器提示。\n \n ---\n\n部分功能截图如下：\n![image](https://github.com/xiaowan/pyadmin/blob/master/snapshot/WechatIMG140.jpeg)\n\n![image](https://github.com/xiaowan/pyadmin/blob/master/snapshot/WechatIMG141.jpeg)\n\n![image](https://github.com/xiaowan/pyadmin/blob/master/snapshot/WechatIMG142.jpeg)\n\n![image](https://github.com/xiaowan/pyadmin/blob/master/snapshot/WechatIMG143.jpeg)\n\n![image](https://github.com/xiaowan/pyadmin/blob/master/snapshot/WechatIMG139.jpeg)\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaowan%2Fpyadmin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaowan%2Fpyadmin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaowan%2Fpyadmin/lists"}