跳转到主要内容

Django项目的流程和自动化

项目描述

PyPI - Python Version PyPI - Django Version GitHub

PyPI Read the Docs codecov

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-py3-none-any.whl (56.0 kB 查看哈希值)

上传时间 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面