Management commands now use argparse instead of optparse to parse command-line arguments passed to commands. This also means that the way to add custom arguments to commands has changed: instead of extending the option_list class list, you should now override the add_arguments() method and add arguments through argparse.add_argument().
Using Django from git results in a traceback:
Traceback (most recent call last):
File "./manage.py", line 25, in <module>
execute_from_command_line(sys.argv)
File "/home/myproject/.virtualenvs/myproject/src/django/django/core/management/__init__.py", line 349, in execute_from_command_line
utility.execute()
File "/home/myproject/.virtualenvs/myproject/src/django/django/core/management/__init__.py", line 341, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/myproject/.virtualenvs/myproject/src/django/django/core/management/__init__.py", line 193, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/myproject/.virtualenvs/myproject/src/django/django/core/management/__init__.py", line 40, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/myproject/.virtualenvs/myproject/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/myproject/.virtualenvs/myproject/src/django-assets/django_assets/management/commands/assets.py", line 94, in <module>
class Command(BaseCommand):
File "/home/myproject/.virtualenvs/myproject/src/django-assets/django_assets/management/commands/assets.py", line 95, in Command
option_list = BaseCommand.option_list + (
AttributeError: type object 'BaseCommand' has no attribute 'option_list'
From the 1.8 release notes - https://docs.djangoproject.com/en/1.9/releases/1.8/#extending-management-command-arguments-through-command-option-list:
Using Django from git results in a traceback: