Django Debug Toolbar installation

585 views
Skip to first unread message

Richard Jackson

unread,
Jan 28, 2017, 11:39:48 AM1/28/17
to Django users
Hi everyone,

I've recently installed the Django Debug Toolbar for local use; I've just pushed the code online and am greeted with the below error:

[81.95.157.172] out: Traceback (most recent call last):
[81.95.157.172] out:   File "<string>", line 1, in <module>
[81.95.157.172] out:   File "/home/rjackson87/.virtualenvs/richardjackson/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
[81.95.157.172] out:     apps.populate(settings.INSTALLED_APPS)
[81.95.157.172] out:   File "/home/rjackson87/.virtualenvs/richardjackson/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
[81.95.157.172] out:     app_config = AppConfig.create(entry)
[81.95.157.172] out:   File "/home/rjackson87/.virtualenvs/richardjackson/lib/python2.7/site-packages/django/apps/config.py", line 86, in create
[81.95.157.172] out:     module = import_module(entry)
[81.95.157.172] out:   File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
[81.95.157.172] out:     __import__(name)
[81.95.157.172] out: ImportError: No module named debug_toolbar
[81.95.157.172] out:

Fatal error: run() received nonzero return code 1 while executing!

Requested: python -c "import os;os.environ['DJANGO_SETTINGS_MODULE']='richardjackson.settings';import django;django.setup();from django.conf import settings;print(settings.STATIC_ROOT)"
Executed: /bin/bash -l -c "cd /home/rjackson87/webapps/richardjackson >/dev/null && source /home/rjackson87/.virtualenvs/richardjackson/bin/activate && python -c \"import os;os.environ['DJANGO_SETTINGS_MODULE']='richardjackson.settings';import django;django.setup();from django.conf import settings;print(settings.STATIC_ROOT)\""

What should I do to resolve this?

Cheers,

Rich

Vijay Khemlani

unread,
Jan 28, 2017, 11:58:56 AM1/28/17
to django...@googlegroups.com
Did you install debug_toolber on your server?

pip install django-debug-toolbar
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d3657e15-1375-481c-ba6d-f3a97ed0dca5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Richard Jackson

unread,
Jan 29, 2017, 12:48:31 PM1/29/17
to Django users
Hi Vijay - that's going to be the problem; I've installed it locally but haven't installed it on my (Webfaction-provided) server.

Thanks,

Rich

Melvyn Sopacua

unread,
Jan 29, 2017, 8:43:15 PM1/29/17
to django...@googlegroups.com

On Sunday 29 January 2017 09:48:31 Richard Jackson wrote:

> Hi Vijay - that's going to be the problem; I've installed it locally

> but haven't installed it on my (Webfaction-provided) server.

 

So don't add it to installed apps. One common pattern is to only enable debug tools when settings.DEBUG is True.

 

So in settings.py make sure INSTALLED_APPS is a list (not a tuple), remove debug_toolbar and add this code:

 

if DEBUG:

INSTALLED_APPS.append('debug_toolbar')

 

Done.

 

Now, all you have to do is not enable DEBUG on the server. Of course, that's the same problem since you're pushing settings.py to the server. And for that, see how Mezzanine solved it using a local_settings.py that is not pushed to the server.

--

Melvyn Sopacua

Reply all
Reply to author
Forward
0 new messages