Forums

python manage.py shell suddenly stopped working

My Django shell (python manage.py shell) suddenly stopped working (it has always worked perfectly for me). It gives the following error:

django.core.exceptions.ImproperlyConfigured: 'mysql.connector.django' isn't an available database backend. Try using django.db.backends.XXX, where XXX is one of: 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'

I am running Python 3.4 + Django 1.7 + mysql with the connector at https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-2.0.1.tar.gz.

My configuration in settings.py is

DATABASES = { 'xxx': { 'ENGINE': 'mysql.connector.django', 'NAME': 'yyy$xxx', 'USER': 'zzz', 'PASSWORD': 'ppp', 'HOST': 'mysql.server', } }

I did not change anything in my configuration since the last time I was able to use the django shell.

Since you're using Django 1.7, I assume you're using a virtualenv? Did you definitely activate the virtualenv before running manage.py shell?

Thanks a lot, Harry. I hadn't realized I was out of the virtualenv. It now works.