1 Star 2 Fork 0

edsionxuanxuan / mir

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
MIT

mir

介绍

通用的django项目结构,已支持认证,权限,异常处理,字段校验,模型序列化,jwt,redis工具类,rabbitmq工具类等

环境

1.python3.8及以上(作者本人用的3.10)

安装教程

  • 1.克隆项目地址
  • 2.打开后安装python相关包(pip install -r requirements.txt)
  • 3.改yml文件(mysql/rabbitmq/redis/apps),改成你自己本地的,一定一定一定一定!!!(不然运行不起来)
  • 4.运行python3 mir.py runserver 0.0.0.0:8080

目录介绍

  • apps 所有子应用集合
  • user 具体的一个子应用
    • controller 处理请求及响应处理
    • models 模型类
    • service 业务处理(因为用的orm,就不再细分了,有兴趣的自己再解耦一层数据层吧)
    • exception文件 子应用自己的异常处理
    • req文件 请求数据封装及校验
    • urls文件 子路由
  • base 顶层封装
  • common 一些共用的工具类
  • conf 相关配置的yml文件存放
  • settings 环境配置(dev/pro/test)
  • tests 测试用例

开发流程介绍

  • 1.有些能写yml的配置就尽量写yml配置,比如注册app应用,目前是把app应用抽离成yml了,只需编写yml即可
  • 2.yml配置写完后,只需要在dev_settings文件中添加即可,项目启动时会全部加载读取配置文件
  • 3.创建子应用,直接在外部使用python mir startapp 子应用名 创建,然后拖到apps下面即可
  • 4.编写model模型类
  • 4.编写url,视图类
  • 5.controller层处理请求及响应
  • 6.req请求数据封装及校验
  • 7.service层,业务逻辑及orm,这边不再细分了,需要细分的话,自己再把orm层抽离出来
  • 8.异常处理,建议每个应用中编写自己的异常处理,继承MirAPIException,提供msg和code即可

目前支持

  • jwt令牌
  • 认证
  • 权限
  • 异常处理
  • 字段校验
  • 模型序列化
  • 日志
  • redis工具类
  • rabbitmq工具类
MIT License Copyright (c) 2023 edsionxuanxuan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

通用的django项目结构,已支持认证,权限,异常处理,字段校验,模型序列化,jwt,redis工具类,rabbitmq工具类等 expand collapse
Python
MIT
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
Python
1
https://gitee.com/edsionxuanxuan/mir.git
git@gitee.com:edsionxuanxuan/mir.git
edsionxuanxuan
mir
mir
master

Search