📜  django 中的管理命令 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:26.637000             🧑  作者: Mango

代码示例2
from django.core.management.base import BaseCommand
from django.utils import timezone

class Command(BaseCommand):
    help = 'Displays current time'

    def handle(self, *args, **kwargs):
        time = timezone.now().strftime('%X')
        self.stdout.write("It's now %s" % time)