1

I have a custom django admin call that I am able to successfully call from the command line using: python manage.py mycustomcommand. Therefore, the directories are setup with the necessary init files in 'management' and 'commands' folders, and I have listed the apps under INSTALLED_APPS in my settings file.

When I try to run the command from another file and use call_command('mycustomcommand') is says the command is an unknown command. How does it work from the command line but not from call_command? I ran get_commands() from 'core.management' and my command is not listed there. Do I need to do something more so that it can be found?

If it matters, I am trying to call mycustomcommand from an app directory that is different from the app directory where the custom command lives. All my app directories have the correct structure and are in INSTALLED_APPS. All my googling seems to suggest it should just work and I've tried all reasonable suggestions to no avail. Thanks for any insight.

1
  • 1
    The question was ok and doesn t need specific code for be understanding by those who know the problem. Can we have a proper answer ? Commented Dec 20, 2017 at 14:39

1 Answer 1

0

It turns out that for my purposes, I needed to be calling my custom commands from within another custom command file. My intent was to have one file that would call my other custom commands and this wasn't working with just a regular Python file. As soon as I made this regular Python file into another custom command file, it worked for what I needed.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.