Opened 7 years ago

Last modified 7 years ago

#29114 closed Bug

Please make `django-admin shell` easier to use. — at Version 1

Reported by: pannous Owned by: nobody
Component: Core (Management commands) Version: 2.0
Severity: Normal Keywords: django-admin manage.py shell repl
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

Please make manage.py shell work out of the box:

> django-admin shell 
django.core.exceptions.ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. 
> manage.py shell
django.core.exceptions.ImproperlyConfigured: Requested setting USE_I18N ...

After 20 minutes I found the 'solution' to the this problem, but the second issue is unresolved:

django-admin shell --settings=poll.settings
TypeError: catch_config_error() missing 1 required positional argument

full log:

django-admin shell --settings=poll.settings
Traceback (most recent call last):
  File "/usr/local/bin/django-admin", line 11, in <module>
    sys.exit(execute_from_command_line())
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/shell.py", line 99, in handle
    return getattr(self, shell)(options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/shell.py", line 35, in ipython
    from IPython import start_ipython
  File "/usr/local/lib/python3.5/dist-packages/IPython/__init__.py", line 54, in <module>
    from .core.application import Application
  File "/usr/local/lib/python3.5/dist-packages/IPython/core/application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/__init__.py", line 6, in <module>
    from .application import *
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 120, in <module>
    class Application(SingletonConfigurable):
  File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 291, in Application
    def initialize(self, argv=None):

Change History (1)

comment:1 by Ramiro Morales, 7 years ago

Description: modified (diff)

Please provide more details on what steps you've performed before reaching this point. like:

  • How have you installed Django
  • Have you installed it in such a way that django-admin.py got copied to /usr/local/bin or is it a remnant from another installation?
  • Des your Django project already have some apps added to INSTALLED_APPS or is it a recently created one?
  • Was this Django project working before?

The traceback seems to have been cut but there are traces of a 'traitlets' Django application. Is it an app of yours or a third party one? Can you try the manage.py commands you posted but after removing that app from the Django project? Or maybe create a new project and try the commands there so you can detect if the problem is actually caused by Django and not by broken/out of date apps.

Please reopen if you can provide such information.

Last edited 7 years ago by Ramiro Morales (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top