Custom Admin Command

20 views
Skip to first unread message

Mario R. Osorio

unread,
Oct 16, 2016, 9:58:25 PM10/16/16
to Django users
I am trying to implement a custom admin command. The class is located at mt_project/my_app/management/command/my_command
and looks like this:

 
class Command(BaseCommand):
help = 'This is my command'

def handle(self, *args, **options):
...


My app is included in Installed_apps. I think I've covered all documented requirements yet; the command is just NOT available. manage.py tells me it is un "Unknown command"

What am I doing wrong?

Thanks a lot in advanced!

Mario R. Osorio

unread,
Oct 16, 2016, 10:04:58 PM10/16/16
to Django users

By the way, there are __init__.py files in both my_project/my_app/management/ and my_project/my_app/management/command folders ...

Dylan Reinhold

unread,
Oct 16, 2016, 10:31:08 PM10/16/16
to django...@googlegroups.com
Is your my_command file named my_command.py?

how are you calling it `manage.py my_command`?

Dylan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f679ba2c-cc77-41c6-a1b3-39e9482d5a61%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Mario R. Osorio

unread,
Oct 16, 2016, 10:44:31 PM10/16/16
to django-users
Thanks a lot for your help Dylan,

Right after writing I noticed my mistake, I was naming the folder my_app/management/command

I renamed it my_app/management/commands and voila!.

it worked like a charm.


Dtb/Gby
=======
Mario R. Osorio
A.S. of Computer Programming and Analysis

“If I had asked people what they wanted, they would have said faster horses.”
 ― Henry Ford

            

      
           

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/1PuWQKwfRcU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages