[Django] #16743: django-admin.py check for database config includind during help subcommand

2 views
Skip to first unread message

Django

unread,
Sep 1, 2011, 4:26:07 PM9/1/11
to django-...@googlegroups.com
#16743: django-admin.py check for database config includind during help subcommand
-------------------------------------+-------------------------------------
Reporter: jgomo3@… | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Core (Management
Version: 1.3 | commands)
Keywords: management django- | Severity: Normal
admin.py manage.py | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If database settings define a dabatase engine not supported by the Python
installation, it fails trying to show the "help" of any database related
subcommand (i.e. sql*, syncdb, dumpdata, etc.).

In my case, i have 'postgresql_psycopg2' as 'ENGINE' value of the default
database in settings.py (my production settings) and my python
installation doesn't support postgresql. So, when i write:


{{{
$ python manage.py help dumpdata
}}}

i receive
{{{
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2
module: No module named psycopg2
}}}

It should simply show the help text. This problems also happen with the
tab autocomplete, if the system autocomplete knows how to autocomplete the
django-admin.py subcommands, as is in my case in an Ubuntu 11.04
installation and Django installed via apt-get.

--
Ticket URL: <https://code.djangoproject.com/ticket/16743>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 1, 2011, 5:14:01 PM9/1/11
to django-...@googlegroups.com
#16743: django-admin.py check for database config includind during help subcommand
-------------------------------------+-------------------------------------
Reporter: jgomo3@… | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Core (Management
Version: 1.3 | commands)
Resolution: | Severity: Normal
Triage Stage: Accepted | Keywords: management django-
Needs documentation: 0 | admin.py manage.py
Patch needs improvement: 0 | Has patch: 0
UI/UX: 0 | Needs tests: 0
| Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by akaariai):

* cc: anssi.kaariainen@… (added)
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

I checked this, and the problem is that if you want to get the help text,
you need to import the command class. The sql command classes use
DEFAULT_DB_ALIAS from django.db and that is enough to get the
ImproperlyConfigured Error. They uses the DEFAULT_DB_ALIAS as a default to
--database option. And you don't have the help text available if you don't
create the option. So, I don't see any trivial way to solve this. Allowing
the import of DEFAULT_DB_ALIAS without an error and then being really
careful about imports in commands would solve this, but that solution
isn't ideal.

--
Ticket URL: <https://code.djangoproject.com/ticket/16743#comment:1>

Django

unread,
Dec 24, 2011, 9:02:59 AM12/24/11
to django-...@googlegroups.com
#16743: django-admin.py check for database config includind during help subcommand
-------------------------------------+-------------------------------------
Reporter: jgomo3@… | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.3
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: management django- | Needs documentation: 0
admin.py manage.py | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


Comment:

Possible approach to this issue. Tests are not trivial.

--
Ticket URL: <https://code.djangoproject.com/ticket/16743#comment:2>

Django

unread,
Dec 14, 2013, 9:23:03 AM12/14/13
to django-...@googlegroups.com
#16743: django-admin.py check for database config includind during help subcommand
-------------------------------------+-------------------------------------
Reporter: jgomo3@… | Owner: nobody
Type: Bug | Status: closed

Component: Core (Management | Version: 1.3
commands) | Resolution:
Severity: Normal | worksforme
Keywords: management django- | Triage Stage: Accepted
admin.py manage.py | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0

Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: new => closed
* resolution: => worksforme


Comment:

Progress has been made on delaying some imports generally. With current
master, I cannot reproduce this issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/16743#comment:3>

Reply all
Reply to author
Forward
0 new messages