通用后台框架 3.7
特性
- 在settings 配置INSTALL_APPS即可.
- 无需配置urls,文件,约定大于配置.
- 功能按apps目录分离.
- 前后端分离,后端只返回json
- 快速生成CURD模型
- 多国语言
- python manage.py makemessages -i venv -l en
- python manage.py compilemessages -l en
不要使用 django-admin ,会把 venv 带进去
- 支持OpenApi 自动生成文档,客户端
- python manage.py generate_swagger -f json -o static/api.json
- 使用 idea OpenAPI Generator 插件生成客户端,On an OpenAPI Definition JSON or YAML file: Code -> OpenAPI -> Generate from document
- 使用 jinja2 模板引擎
放弃rest ,不适合业务
- status_code 不够使用
- 地址/xx/{id} 形式,容易产生缓存,不容易测试,批量删除与修改不方便
- rest_framework 默认是使用csrf_exempt
- 只使用 post ,get 方法
设置apps目录
pycharm -> project structure -> 设置apps目录为source
新建表结构
python3 manage.py migrate
前端使用库
- jquery https://jquery.com/
- 表单 jquery.form http://malsup.com/jquery/form/
- ui 框架 bootstrap-3 https://v3.bootcss.com/
- Bootstrap Tags Input http://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/
- 弹出框 dialog http://demo.jb51.net/js/2011/artDialog/_doc/API.html
- 表格 bootstrap-table https://examples.bootstrap-table.com/index.html?bootstrap3#view-source
- 选择框 select2 https://select2.org/
- 日期框 daterangepicker https://www.daterangepicker.cn/
- progress.js https://usablica.github.io/progress.js/
- vue 2.6 https://vuejs.org/
- ant design vue https://www.antdv.com/docs/vue/introduce-cn/
redoc
- 使用 swagger_auto_schema 添加注释文档
- query_serializer 查询参数 get/post 使用
- request_body 请求主体 post 用
- responses 返回
- 生成 json/yaml 文件
python manage.py generate_swagger -f yaml - >static/yaml.json
- OpenAPI Generator 自动生成客户端文件 pycharm 插件 code -> OpenApi
需要解决
-
统一用 swagger_auto_schema 添加api文档注释,并且增加参数校验
- 侵入度低,使用 annotations 辅助
-
返回response 统一带 code 参数有,需要统一增加,返回错误代码,也许动态增加,建议不使用动态生成rsp
-
请求 body ,query, 需要添加filter,page_size 参数
快速上手 开发流程
创建 app
- 与 django 命令相同,不过默认使用 framework 下的 app 模板
pip3 install djmyframework
mkdir xxxProject
cd xxxProject
djmyframework_init
python3 manage.py create_app xxxApp
python3 manage.py migrate
python3 manage.py create_root
python3 manage.py create_role
python3 manage.py create_menu -m config.system_menu
创建增删改查
- 定义好 models 后, 执行自动创建 view,template 模板
python3 manage.py create_curd {app_name}.{Model}
部署
- 安装依赖
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
- 静态文件部署
python manage.py collectstatic
- 启动服务 参看 supervisorctl 用法
mysupervisorctl start
Metadata
Release files for djmyframework 0.1.44
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| djmyframework-0.1.44.tar.gz | 12.8 MB | Without provenance | Details for djmyframework-0.1.44.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| djmyframework-0.1.44-py3-none-any.whl | Python 3 | none | any | Details for djmyframework-0.1.44-py3-none-any.whl |
Total release size: 27.2 MB
Release files / djmyframework-0.1.44.tar.gz
| Download URL | djmyframework-0.1.44.tar.gz |
|---|---|
| Size | 12.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08cc9abfe953b04a09f7f4f894b8bde1c9e51bfe875d6b542daf7efccde67a02
|
|
BLAKE2b-256 checksum How to use checksums |
8683a2c89d37990a6ebb229693f7f1e982a8137f4de098fb77482df6da6d7a95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.9
|
Release files / djmyframework-0.1.44-py3-none-any.whl
| Download URL | djmyframework-0.1.44-py3-none-any.whl |
|---|---|
| Size | 14.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d2fe4f06da67596c32c2c6fd4f2361e1262727556ace7f4c89ed6da95490a10
|
|
BLAKE2b-256 checksum How to use checksums |
e85e7bc5c3702a703cb812dffdddad9c10d458d09ca8cecca2eee5a5f21f4c45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.9
|
Security for djmyframework 0.1.44
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.