a3dj
基于django做了一些规则设定,让开发过程更简单
特点
- 不用专门写注解或语法,就可以全量生成open api文档,包含各种异常返回
- 非常方便写单元测试
- 抛出一个异常就是一个异常响应;单元测试时甚至也可以在发出请求后去捕获这个异常
- 请求时想用json用json、想用form-data用form-data
自问自答
1. 为什么用纯post的方式,不用restful?
- 如果项目只是纯sql数据对象的增删改查,用restful、GraphQL更合适
- 我经历的项目通常都比这个复杂一些,多种类型的数据库、不能简单抽象为资源的业务、需求还老变、对严谨性要求稍高等,让我使用restful时考虑怎样restful占用了很常时间
- 总的来说,我很快放弃了restful;后来又经历了带新人,甚至想让其他人也能看得懂代码,我的需要就变成了:适应快速变化、简单易懂
- 纯post的方式,也可以提供增删改查的基类便于快速实现增删改查;对于习惯了restful风格开发的前后端程序员来说,这个只会更简单
2. 为什么不使用或基于django-rest-framework?
- 它很复杂、上手需要花费较多时间进行系统的学习
- 不直观、不易懂,反而容易混淆,比如serializer
3. 为什么重新写form模块?
- django的form模块对于生成open api文档来说,太简陋了;对于平常使用(非admin)来说太重了
Metadata
Release files for a3dj 0.1.0
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 |
|---|---|---|---|---|
| a3dj-0.1.0.tar.gz | 42.1 kB | Without provenance | Details for a3dj-0.1.0.tar.gz |
Release files / a3dj-0.1.0.tar.gz
| Download URL | a3dj-0.1.0.tar.gz |
|---|---|
| Size | 42.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80aca7a0d54a799566d5022bdf3a66a7411a7724fe058beae45e75fe3f6a598c
|
|
BLAKE2b-256 checksum How to use checksums |
017a58fa22f57e5792f5e93a6837c422fa56328cf69d1a3465a85069d425936a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Security for a3dj 0.1.0
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.