15👍
I would need to see your DATABASES configuration in settings.py, but it looks like it is trying to load MySQLDB instead of the Mysql Python Connector that you installed. The DATABASES should look something like this:
DATABASES = {
'default': {
'NAME': 'mydatabase',
'ENGINE': 'mysql.connector.django',
'USER': 'myuser',
'PASSWORD': 'secretpassword',
'OPTIONS': {
'autocommit': True,
},
}
}
Note the ENGINE part… that tells Django to use the mysql connector instead of MySQLDB…
more info available here:
http://bunwich.blogspot.com/2014/02/finally-mysql-connector-that-works-with.html
http://dev.mysql.com/doc/connector-python/en/connector-python-django-backend.html
and if you are expecting to use South:
www.pythonanywhere.com/wiki/UsingMySQL
You may want to note that the Oracle connecter is GPL, and there may be license issues with using that code. See Here:
groups.google.com/forum/#!topic/django-developers/8r_RVmUe5ys
The Django 1.7 documentation recommends using the mysqlclient driver…
docs.djangoproject.com/en/1.7/ref/databases/
–see the section on Mysql DB API Drivers
pypi.python.org/pypi/mysqlclient for that client…
-Scott
28👍
None of the existing answers worked for me on Ubuntu Server 16.04 so I ran:
sudo apt-get install libmysqlclient-dev
sudo -H pip3 install mysqlclient
The first command get me the mysql config needed by the second command.
- [Django]-Test sending email without email server
- [Django]-Django won't refresh staticfiles
- [Django]-How to chain Django querysets preserving individual order
- [Django]-Token Authentication for RESTful API: should the token be periodically changed?
- [Django]-How to filter a django queryset using an array on a field like SQL's "IN"?
- [Django]-Django.request logger not propagated to root?
13👍
If you can install pymysql — which works well for me with Python 3.4 — then add these lines to your manage.py file in Django:
try:
import pymysql
pymysql.install_as_MySQLdb()
except ImportError:
pass
This will make pymysql function like MySQLdb and worked for me.
- [Django]-Serving favicon.ico with Django. Why does settings.MEDIA_URL with django.views.generic.simple.redirect_to only work on dev environment?
- [Django]-How to deploy django under a suburl behind nginx
- [Django]-Auto-reloading of code changes with Django development in Docker with Gunicorn
- [Django]-What's the differences between has_object_permission and has_permission?
- [Django]-Celery task with a time_start attribute in 1970
- [Django]-Authenticate by IP address in Django