How can I install django debug toolbar? - python

I use ubuntu and I installed the django debug toolbar with pip using sudo pip install django-debug-toolbar. Then I added it to my settings file. Now when I start the django app server I get this error message.
Traceback (most recent call last):
File "./social/manage.py", line 16, in <module>
execute_from_command_line(sys.argv)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
ImportError: No module named debug_toolbar
(kthsocial)dac#dac-VPCSA2Z9E:/etc/social/social$ ./social/manage.py runserver
Traceback (most recent call last):
File "./social/manage.py", line 16, in <module>
execute_from_command_line(sys.argv)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/home/dac/.virtualenvs/kthsocial/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
ImportError: No module named debug_toolbar
Why doesn't it work?

This is because sudo pip install django-debug-toolbar never installed django-debug-toolbar in your virtualenv. Make sure your virtualenv is activate and use pip install django-debug-toolbar. Don't use sudo

Don't use sudo to install things when you're in a virtualenv.

Related

ImportError: No module named robots

When I try to start the server, this error occurred:
ImportError: No module named robots
I have tried to use pip:
pip install robots
but there is no such module
traceback as follow:
(env) U:\Python\mdknowledge>python manage.py runserver 0.0.0.0:8000
Traceback (most recent call last):
File "manage.py", line 8, in <module>
execute_from_command_line(sys.argv)
File "U:\Python\mdknowledge\env\lib\site-packages\django\core\management\__ini
t__.py", line 399, in execute_from_command_line
utility.execute()
File "U:\Python\mdknowledge\env\lib\site-packages\django\core\management\__ini
t__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "U:\Python\mdknowledge\env\lib\site-packages\django\core\management\base.
py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "U:\Python\mdknowledge\env\lib\site-packages\django\core\management\base.
py", line 280, in execute
translation.activate('en-us')
File "U:\Python\mdknowledge\env\lib\site-packages\django\utils\translation\__i
nit__.py", line 130, in activate
return _trans.activate(language)
File "U:\Python\mdknowledge\env\lib\site-packages\django\utils\translation\tra
ns_real.py", line 188, in activate
_active.value = translation(language)
File "U:\Python\mdknowledge\env\lib\site-packages\django\utils\translation\tra
ns_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "U:\Python\mdknowledge\env\lib\site-packages\django\utils\translation\tra
ns_real.py", line 159, in _fetch
app = import_module(appname)
File "U:\Python\mdknowledge\env\lib\site-packages\django\utils\importlib.py",
line 40, in import_module
__import__(name)
ImportError: No module named robots
try pip:
(env) U:\Python\mdknowledge>pip install robots
Collecting robots
Could not find a version that satisfies the requirement robots (from versions:
)
No matching distribution found for robots
pip install django-robots
Read the install instructions

ImportError: No module named chosen

I recently have downloaded a django project off of github (it is confidential so I cannot share the code). And I am writing a script that should be processing some of the models. I changed the correct information in the settings and have created my basic script for testing that looks like the this:
from appname.models import *
print "hello world"
When I try python manage.py shell < script.py I get ImportError: No module named chosen. Why is this and what can I do to get my script to run?
here is the full traceback:
Setting Django settings
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/utils/importlib.py", line 40, in import_module
__import__(name)
ImportError: No module named chosen
Maybe the "chosen" django plugin needs to be installed.

Error: The 'elasticsearch' backend requires the installation of 'requests'. How do I fix it?

I´m having a issue when I ran "python manage.py rebuild_index" in my app supported by haystack and elasticsearch.
Python 2.7
Django version 1.6.2
Haystack 2.1.0
Elasticsearch 1.0
Please see the error that is appearing:
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/init.py", line 399, in > execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/site-packages/django/core/management/init.py", line 392, in > execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 242, in >run_from_argv
self.execute(*args, **options.dict)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/site-packages/haystack/management/commands/rebuild_index.py", line 15, in handle
call_command('clear_index', **options)
File "/usr/lib/python2.7/site-packages/django/core/management/init.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/site-packages/haystack/management/commands/clear_index.py", line 48, in handle
backend = connections[backend_name].get_backend()
File "/usr/lib/python2.7/site-packages/haystack/utils/loading.py", line 98, in getitem
self._connections[key] = load_backend(self.connections_info[key]['ENGINE'])(using=key)
File "/usr/lib/python2.7/site-packages/haystack/utils/loading.py", line 51, in load_backend
return import_class(full_backend_path)
File "/usr/lib/python2.7/site-packages/haystack/utils/loading.py", line 18, in import_class
module_itself = importlib.import_module(module_path)
File "/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
import(name)
File "/usr/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 21, in
raise MissingDependency("The 'elasticsearch' backend requires the installation of 'requests'.")
haystack.exceptions.MissingDependency: The 'elasticsearch' backend requires the installation of 'requests'.
I've installed all the packages needed to run those apps however is asking about requests, What is it about?
just do
pip install pyelasticsearch
If you just install requests module through pip this error should go away.

manage.py runserver fails

OS X, Python 2.7, a fresh virtualenv:
virtualenv bar
source bar/bin/activate
pip install django --upgrade
django-admin.py startproject foo
cd foo
python manage.py runserver
Then I immediately get this:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/core/management/base.py", line 209, in execute
translation.activate('en-us')
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 100, in activate
return _trans.activate(language)
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 43, in __getattr__
if settings.USE_I18N:
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/utils/functional.py", line 276, in __getattr__
self._setup()
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/conf/__init__.py", line 139, in __init__
logging_config_func(self.LOGGING)
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/utils/dictconfig.py", line 553, in dictConfig
dictConfigClass(config).configure()
File "/Users/xyz/.virtualenvs/bar/lib/python2.7/site-packages/django/utils/dictconfig.py", line 321, in configure
del logging._handlerList[:]
AttributeError: 'module' object has no attribute '_handlerList'
What's going wrong?
This issue seems somehow related to virtualenvwrapper, and my own stupidity; creating a virtualenv manually has resolved it.

ImportError: No module named modelsinspector

I get the following error when I do syncdb
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/usr/lib/python2.7/site-packages/django/core/management/commands/shell.py", line 18, in handle_noargs
loaded_models = get_models()
File "/usr/lib/python2.7/site-packages/django/db/models/loading.py", line 167, in get_models
self._populate()
File "/usr/lib/python2.7/site-packages/django/db/models/loading.py", line 64, in _populate
self.load_app(app_name)
File "/usr/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in load_app
models = import_module('.models', app_name)
File "/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
.
.
.
.
from south.modelsinspector import add_introspection_rules
ImportError: No module named modelsinspector
Why have you installed South 0.5? The current version of South is 0.7.3 - 0.5 is more than two years old and dates from before the reorganisation that added the modelsinspector module. Delete that version and install the latest one.
You are missing module modelsinspector. Install it.

Categories