Answers for "python django management command"

3

python django shell command

$ python manage.py shell
...
>>> execfile('myscript.py')
Posted by: Guest on April-03-2020
0

management command in django

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)
Posted by: Guest on April-14-2021

Code answers related to "python django management command"

Python Answers by Framework

Browse Popular Code Answers by Language