rednaxela rednaxela - 1 year ago 109
Python Question

Django custom command - Not Implemented Error

I'm trying to set up a cronjob on my Ubuntu server to run a django

file - but I'm having trouble running the script first.

I'm using the command
python3 /opt/mydir/ updatefm

which produces the error:

File "/opt/mydir/", line 15, in <module>
File "/usr/local/lib/python3.4/site-packages/django/core/management/", line 399, in execute_from_command_line
File "/usr/local/lib/python3.4/site-packages/django/core/management/", line 392, in execute
File "/usr/local/lib/python3.4/site-packages/django/core/management/", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python3.4/site-packages/django/core/management/", line 285, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.4/site-packages/django/core/management/", line 324, in handle
raise NotImplementedError()

Can anybody enlighten my on what I'm doing incorrect? Here is my script and structure:


class Command(BaseCommand):
args = ''
help = 'Help Test'
def update_auto(self, *args, **options):
hi = 'test'

My app name is listed in
as it should be.

Answer Source

Check inside commands folder. Then you have to use handle method

class Command(BaseCommand):
    args = ''
    help = 'Help Test'
    def handle(self, *args, **options):
        hi = 'test

For more info

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download