未提供项目描述
项目描述
安装
$ 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的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 1076b510e90066d8d301be8b7632eab8e8ffd8d48549ee98c1d99244380301f8 |
|
MD5 | 71ebbcf63e3b66ad4faca2093e45cd1f |
|
BLAKE2b-256 | 132b4fbfc5cfd23d22fe7a44102b1e02e89264bee44fbe8a9eea3303b8ce7cb3 |