Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Since Django upgrade, runserver can't find DebugToolbar #1322

Closed
imported-from-roundup opened this issue Aug 8, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@imported-from-roundup
Copy link

commented Aug 8, 2014

Comment by ehashman:

I now get the following error when I try to ./manage.py runserver:

Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of
<django.core.management.commands.runserver.Command object at 0x2908b50>>
Traceback (most recent call last):
[ ... snip ... ]
File "src/oh-mainline/vendor/packages/Django/django/utils/importlib.py", line
35, in import_module
import(name)
File
"src/oh-mainline/vendor/packages/django-debug-toolbar/debug_toolbar/models.py",
line 9, in <module>
dt_settings.patch_all()
File
"src/oh-mainline/vendor/packages/django-debug-toolbar/debug_toolbar/settings.py", line
214, in patch_all
patch_middleware_classes()
File
"src/oh-mainline/vendor/packages/django-debug-toolbar/debug_toolbar/settings.py", line
193, in patch_middleware_classes
if not is_toolbar_middleware_installed():
File
"src/oh-mainline/vendor/packages/django-debug-toolbar/debug_toolbar/settings.py", line
175, in is_toolbar_middleware_installed
for middleware in settings.MIDDLEWARE_CLASSES)
File
"src/oh-mainline/vendor/packages/django-debug-toolbar/debug_toolbar/settings.py", line
175, in <genexpr>
for middleware in settings.MIDDLEWARE_CLASSES)
File
"src/oh-mainline/vendor/packages/django-debug-toolbar/debug_toolbar/settings.py", line
162, in is_toolbar_middleware
from debug_toolbar.middleware import DebugToolbarMiddleware
File
"src/oh-mainline/vendor/packages/django-debug-toolbar/debug_toolbar/middleware.py",
line 14, in <module>
from debug_toolbar.toolbar import DebugToolbar
ImportError: cannot import name DebugToolbar

This problem appears to be associated with commit
14b626d

Susan, can you fix?


Comment by paulproteus:

Elana -- if you do:

find -iname '*.pyc' -delete

does that fix it for you?

The upgrade to the latest versions of Django Debug Toolbar involve changes
that might require this. (I kid you not.)


Comment by ehashman:

The following resolved this bug:

find <sourcedir> -name '*.pyc' | xargs rm

Darrick suggests this could be problematic if there are spaces in the filenames
but I like to live dangerously.


Comment by paulproteus:

Great to hear!

We could integrate a hack for this into our 'manage.py' script, if we want
to be a shockingly fully integrated, aggressively newbie-friendly
ecosystem.

(And yeah -- see also "Handling files or folders with spaces in the name"
in http://offbytwo.com/2011/06/26/things-you-didnt-know-about-xargs.html
for more about your 'files with spaces' possible problem.)


Comment by ehashman:

I am going to resolve this bug.

Thought for the future: maybe we should hack our manage.py runserver to do this
deletion.


Status: resolved
Nosy List: ehashman, onceuponatimeforever, paulproteus
Priority: urgent
Imported from roundup ID: 1007 (view archived page)
Last modified: 2014-07-26.18:53:10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.