Albert Albert - 27 days ago 7
Python Question

Run a script which is in a django app under management folder in command folder

I have a django project and inside I have an app. Inside this app I created a management folder, inside this one I create a commands folder, and inside the last one I put my script with the init.py file too. My question is how I can run the script, because if I'm in the django project folder (where is manage.py file) and I execute the line:

python manage.py myscript.py


the terminal is displaying this:

Unknown command: 'myscript.py'

Art Art
Answer

It should be python manage.py myscript, and if everything else is correct it will work.

Note that management command is not just a python script. It must implement class Command inside. (Tutorial)

Comments