ImportError: No module named modelsinspector - python

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.

Related

How can I install django debug toolbar?

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.

Django app engine cannot import name old_dev_appserver

I am trying to use django in appengine. I have followed the installation documentation and setup the project. But ./manage.py runserver command is generating error.
Traceback is,
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/salman/projects/appengine/banglapy/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/home/salman/projects/appengine/banglapy/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/salman/projects/appengine/banglapy/django/core/management/__init__.py", line 263, in fetch_command
app_name = get_commands()[subcommand]
File "/home/salman/projects/appengine/banglapy/django/core/management/__init__.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/home/salman/projects/appengine/banglapy/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/home/salman/projects/appengine/banglapy/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/home/salman/projects/appengine/banglapy/django/conf/__init__.py", line 132, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/home/salman/projects/appengine/banglapy/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/salman/projects/appengine/banglapy/banglapy/settings.py", line 6, in <module>
from djangoappengine.settings_base import *
File "/home/salman/projects/appengine/banglapy/djangoappengine/settings_base.py", line 8, in <module>
from djangoappengine.utils import on_production_server, have_appserver
File "/home/salman/projects/appengine/banglapy/djangoappengine/utils.py", line 24, in <module>
"Error was: %s" % e)
Exception: Could not get appid. Is your app.yaml file missing? Error was: cannot import name old_dev_appserver
how can I resolve this issue?
Google removed the old dev_appserver from the SDK in version 1.9.17. There is an issue on the djangoappengine project about it as well.
https://github.com/django-nonrel/djangoappengine/issues/95

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.

Django Error loading MySqlDB module

I'm new with Django and I follow a tuto. The problem is that the tuto uses Sqlite but I want to use MySql server instead. I changed the parameters following documentation but I have the following error when I try to run the server. I already found some resolve but it didn't work...
For your information, I installed MySql-Python and reinstall Django with PIP. Without any success. I hope you will be able to help me.
Traceback :
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\adescamp>cd C:\Users\adescamp\agregmail
C:\Users\adescamp\agregmail>python manage.py runserver 8000
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 280, in execute
translation.activate('en-us')
File "C:\Python27\lib\site-packages\django\utils\translation\__init__.py", line 130, in activate
return _trans.activate(language)
File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 188, in activate
_active.value = translation(language)
File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 159, in _fetch
app = import_module(appname)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 40, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\contrib\admin\__init__.py", line 6, in <module>
from django.contrib.admin.sites import AdminSite, site
File "C:\Python27\lib\site-packages\django\contrib\admin\sites.py", line 4, in <module>
from django.contrib.admin.forms import AdminAuthenticationForm
File "C:\Python27\lib\site-packages\django\contrib\admin\forms.py", line 6, in <module>
from django.contrib.auth.forms import AuthenticationForm
File "C:\Python27\lib\site-packages\django\contrib\auth\forms.py", line 17, in <module>
from django.contrib.auth.models import User
File "C:\Python27\lib\site-packages\django\contrib\auth\models.py", line 48, in <module>
class Permission(models.Model):
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Python27\lib\site-packages\django\db\models\options.py", line 124, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Python27\lib\site-packages\django\db\__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Python27\lib\site-packages\django\db\utils.py", line 198, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Python27\lib\site-packages\django\db\utils.py", line 113, in load_backend
return import_module('%s.base' % backend_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 40, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 17, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
Thank you!
I found the solution!
I had to install mysql-python. Easy but: don't do that with PIP because it won't work. You have to install mysql-p
as you are running python on windows. Pip install mysql-python won't work. Try using python-mysql from here http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

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.

Categories