mardi 12 août 2014

python - Django et problèmes de mysql sur Mavericks - Stack Overflow


I'm running Mac OSX 10.9 Mavericks. I'm trying to run django under python 3. Because I'm running Python 3 I have to get the official connector from the mysql devs here gave it a quick test in the shell and it works.


I ran python manage.py runserver with "mysql.connector.django" as the engine having seen an example here and I got this 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:
u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'
Error was: No module named mysql.connector.django.base

So I switch back to the default using "django.db.backends.mysql" as my engine and I get this error:


django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

I have no idea how to proceed. I can't install MySQLdb because I'm running my django install under python3 and it's unsupported, but I'm definitely missing something with this connector.




Use Oracle's mysql connector/python, which is the recommended connector by Django.


https://dev.mysql.com/doc/connector-python/en/connector-python-installation-source-unix.html


Once it's in your site-packages, it will be stored under mysql. Use the full path for django:


mysql.connector.django


Worked for me.



I'm running Mac OSX 10.9 Mavericks. I'm trying to run django under python 3. Because I'm running Python 3 I have to get the official connector from the mysql devs here gave it a quick test in the shell and it works.


I ran python manage.py runserver with "mysql.connector.django" as the engine having seen an example here and I got this 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:
u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'
Error was: No module named mysql.connector.django.base

So I switch back to the default using "django.db.backends.mysql" as my engine and I get this error:


django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

I have no idea how to proceed. I can't install MySQLdb because I'm running my django install under python3 and it's unsupported, but I'm definitely missing something with this connector.



Use Oracle's mysql connector/python, which is the recommended connector by Django.


https://dev.mysql.com/doc/connector-python/en/connector-python-installation-source-unix.html


Once it's in your site-packages, it will be stored under mysql. Use the full path for django:


mysql.connector.django


Worked for me.


0 commentaires:

Enregistrer un commentaire