Django custom command - Not Implemented Error
<p>I'm trying to set up a cronjob on my Ubuntu server to run a django <code>.py</code> file - but I'm having trouble running the script first.</p>

<p>I'm using the command <code>python3 /opt/mydir/manage.py updatefm</code> </p>

<p>which produces the error:</p>

<pre><code>File "/opt/mydir/manage.py", line 15, in &lt;module&gt;
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.4/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python3.4/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.4/site-packages/django/core/management/base.py", line 324, in handle
    raise NotImplementedError()
NotImplementedError
</code></pre>

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

<pre><code>/mydir
   /mydir
      __init__.py
      /management
         __init__.py
         /commands
            updatefm.py
</code></pre>

<p><strong>updatefm.py</strong></p>

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

<p>My app name is listed in <code>settings.py</code> as it should be. </p>

<p>Classes inheriting from <code>BaseCommand</code> must implement the method <code>handle</code>. </p>

<p>In your case, you should change </p>

<p><code>def update_auto(self, *args, **options):</code></p>

<p>to </p>

<p><code>def handle(self, *args, **options):</code></p>

python django python-3.x