Django项目的流程和自动化
项目描述
Django-automations
一个轻量级的框架,用于将您的Django应用程序的所有流程集中在一个地方。
用例
- 营销自动化、客户旅程
- 简单的需要用户交互的业务流程
- 运行常规任务
Django-automations可以与纯Django一起使用,也可以与Django-CMS集成。
主要功能
-
将自动化描述为Python类
-
将自动化绑定到其他Django应用程序中的模型
-
使用Django表单进行用户交互
-
通过可扩展的仪表板创建透明度
-
声明自动化为唯一或针对特定数据集唯一
-
在信号发生时或在用户访问页面等情况下启动自动化
-
在自动化之间发送消息
要求
- Python: 3.7, 3.8, 3.9, 3.10
- Django: 3.0, 3.1, 3.2
反馈
此项目处于早期阶段。欢迎所有反馈!请通过fsbraun(at)gmx.de联系我
安装
此项目将在首次发布后在PyPI上可用。在此期间,请使用以下命令从git安装master分支
pip install https://github.com/fsbraun/django-automations/archive/master.zip
安装后,将automations
添加到settings.py
中已安装的应用程序中
INSTALLED_APPS = (
...,
'automations',
'automations.cms_automations', # ONLY IF YOU USE DJANGO-CMS!
)
如果您使用Django CMS,则仅包含“子应用”automations.cms_automations
。
最后一步是使用 manage.py
命令运行必要的迁移
python manage.py migrate automations
用法
基本思路是在Django的模型、视图、模板结构中添加一个自动化层。自动化层将所有业务流程集中在一个地方,而在Django应用程序中,这些业务流程通常分散在模型、视图和任何粘合代码中。
自动化 由一系列依次执行的 任务 组成。 修饰符 影响任务执行的时间,例如任务何时执行。
from automations import flow
from automations.flow import this
# "this" can be used in a class definition as a replacement for "self"
from . import forms
class ProcessInput(Automation):
"""The process steps are defined by sequentially adding the corresponding nodes"""
start = flow.Execute(this.get_user_input) # Collect input a user has supplied
check = flow.If(
this.does_not_need_approval # Need approval?
).Then(this.process) # No? Continue later
approval = flow.Form(forms.ApprovalForm).Group(name="admins") # Let admins approve
process = flow.Execute(this.process_input) # Generate output
end = flow.End()
critical = 10_000
def get_user_input(task_instance):
...
def does_not_need_approval(task_instance):
return not (task_instance.data['amount'] > self.critical)
def process_input(task_instance):
...
文档
请参阅 readthedocs.io 上的文档。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源分布
django-automations-0.9.4.1.tar.gz (39.8 kB 查看哈希值)
构建分布
关闭
django-automations-0.9.4.1.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 3a4653a1b1141149c3b173422080a94759f18e5feb98833d405dfb39b022343c |
|
MD5 | 19bf625052f08a54fc3fc3eccc9f93f4 |
|
BLAKE2b-256 | 0bed97cb4974ce37eda4a8c1818a286e3366a529d9228bca74555113536049e7 |
关闭
django_automations-0.9.4.1-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a60cfc73ac0488b5e3e7cabde7f8cea3a22b60edfbe8ae2b77f32bb112caff2e |
|
MD5 | a4db0c4cc5f1fd868d23fe0cf0427467 |
|
BLAKE2b-256 | 7f3cfd5d93b5110dd7d9196791225186d450662072f7711be3144cd28cc7e0bb |