{{{
Traceback (most recent call last):
File "manage.py", line 20, in <module>
execute_from_command_line(sys.argv)
File "/Users/map/.virtualenvs/odin/lib/python2.7/site-
packages/django/core/management/__init__.py", line 338, in
execute_from_command_line
utility.execute()
File "/Users/map/.virtualenvs/odin/lib/python2.7/site-
packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/map/.virtualenvs/odin/lib/python2.7/site-
packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/map/.virtualenvs/odin/lib/python2.7/site-
packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/Users/map/.virtualenvs/odin/lib/python2.7/site-
packages/django/core/management/commands/showmigrations.py", line 32, in
handle
connection = connections[db]
File "/Users/map/.virtualenvs/odin/lib/python2.7/site-
packages/django/db/utils.py", line 234, in __getitem__
if hasattr(self._connections, alias):
TypeError: hasattr(): attribute name must be string
}}}
This can be fixed adding `use_argparse = True` to show migrations command
class, so that add_arguments gets executed settting defaults. This way you
get the expected response.
--
Ticket URL: <https://code.djangoproject.com/ticket/24620>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* has_patch: 1 => 0
* easy: 1 => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
I can't reproduce this using the tutorial project.
--
Ticket URL: <https://code.djangoproject.com/ticket/24620#comment:1>
* status: new => closed
* resolution: => worksforme
--
Ticket URL: <https://code.djangoproject.com/ticket/24620#comment:2>
Comment (by maraujop):
Ok,
Seems to be an issue with django-configurations which sets a
`self.option_list` making `use_argparse = True` and then turning the
property False and not calling `add_arguments`.
Related to this:
https://github.com/jezdez/django-configurations/issues/109
Sorry for the false positive.
Miguel
--
Ticket URL: <https://code.djangoproject.com/ticket/24620#comment:3>
Comment (by maraujop):
I've been reading some of the commits that moved from optparse to argparse
Django's command system:
https://github.com/django/django/commit/856863860352aa1f0288e6c9168a0e423c4f5184
https://github.com/django/django/commit/f17b24e407385eb18651bf023a187347aa9c1f75
To be honest if `option_list` has been replaced by `add_arguments`
method. And in
`BaseCommand` `add_arguments` is called only for new system as you can see
here:
https://github.com/django/django/blob/0ed7d155635da9f79d4dd67e4889087d3673c6da/django/core/management/base.py#L308
This change is in reality backwards incompatible (which is not Django's
usual philosophy), although the door stays open for still being backwards
compatible, but it implies author's work. In my understanding usually
Django gives a time gap to adjust apps in situations like this.
As django-configurations is still using optparse and is injecting an
option for all commands, which sets the right configuration to use. It is
breaking all Django commands.
--
Ticket URL: <https://code.djangoproject.com/ticket/24620#comment:4>
Comment (by maraujop):
Seem last commit of django-configurations has this handled already:
https://github.com/jezdez/django-
configurations/blob/master/configurations/importer.py#L37
--
Ticket URL: <https://code.djangoproject.com/ticket/24620#comment:5>