0

I want to carry out the following in Terminal:

python manage.py runserver -c True

with the code below:

manage.py:

from my_app import app

manager = Manager(app)
manager.add_option('-c', '--config', dest='config', required=False)

manager.run()

When I enter the command in terminal, I receive an error stating:

usage: manage.py [-c C] [-?] {shell,runserver} ...
manage.py: error: too many arguments

so it requires me to place the argument -c before runserver for some reason. Although this is a minor issue, I assumed that best practice was that all arguments should be after the command. Why is the argument required before the command in my case? Thanks.

Pav Sidhu
  • 6,724
  • 18
  • 55
  • 110
  • Because you've added the argument to the manager app, not a particular subcommand. – dirn Nov 06 '16 at 20:05
  • @dim right, but then there is no other method to adding arguments to the default runserver command? – Pav Sidhu Nov 06 '16 at 21:15
  • 1
    Not that I've tried. Besides, if runserver doesn't know about the option already, how would it do anything with it? – dirn Nov 06 '16 at 21:29

0 Answers0