跳转到主要内容

未提供项目描述

项目描述

安装

$ pip install django-command-stdout

settings.py

INSTALLED_APPS+=['django_command_stdout']

migrate

$ python manage.py migrate

示例

@command_stdout 装饰器

from django_command_stdout.decorators import command_stdout

class Command(BaseCommand):
    @command_stdout
    def handle(self,*args,**options):

BaseCommand

import io
from django.core.management.base import BaseCommand
from django_command_stdout.models import Stdout

class Command(BaseCommand):
    def execute(self, *args, **options):
        command = type(self).__module__.split('.')[-1]
        with io.StringIO() as f:
            super().execute(*args, stdout=f,**options)
            Stdout(command=command,stdout=f.getvalue()).save()

call_command

from django_command_stdout.utils import call_command

call_command('name',*args,**options)

项目详情


下载文件

下载适合您平台文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

django_command_stdout-0.0.1.tar.gz (2.8 kB 查看哈希值)

上传时间:

支持者

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