#10706: Incorrect error from manage.py sql when app fails to load
------------------------------------------+---------------------------------
 Reporter:  Glenn                         |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  SVN       
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  1                             |  
------------------------------------------+---------------------------------
 {{{
 ./manage.py sql stomp
 Error: App with label stomp could not be found. Are you sure your
 INSTALLED_APPS setting is correct?
 }}}

 This is an incorrect error when the app is found but fails to import.  The
 actual error is never displayed, which is hard to diagnose.  If I add some
 diagnostics in django/db/models/loading.py load_app to print the
 exception, the problem becomes obvious:

 {{{
 ./manage.py sqlall stomp
 cannot import name TestModel
 Error: App with label stomp could not be found. Are you sure your
 INSTALLED_APPS setting is correct?
 }}}

 It should probably just pass the exception up and show a trace.  I've
 attached a patch to do this, but it causes errors when running some tests:

 {{{
 Error while importing humanize:  File "./runtests.py", line 134, in
 django_tests
     mod = load_app(model_label)
   File "/home/glenn/django/django/db/models/loading.py", line 74, in
 load_app
     models = import_module('.models', app_name)
   File "/home/glenn/django/django/utils/importlib.py", line 35, in
 import_module
     __import__(name)
 ImportError: No module named models
 }}}

 for humanize, syndication, sitemaps, databrowse, admindocs and
 localflavor.  Spying on runtests.py django_tests, these seem to be failing
 silently anyway; this is just making the "Error while importing" exception
 handler actually get called, where before they were silent.  I'm not sure
 if there's another bug in there that this is exposing.

 (Watch out: there's both eg. regressiontests.humanize and
 django.contrib.humanize for a few of those tests, and usually one of them
 works and the other doesn't.)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10706>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to