MySQL with Django
To configure Django to access a MySQL database on Python, you need to do this in your settings file:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': '<your_username>$<your_database_name>', 'USER': '<your_username>', 'PASSWORD': '<your_mysql_password>', 'HOST': '<your_mysql_hostname>', } }
But on python 3 you will get following error.
Error loading MySQLdb module: No module named MySQLdb.
For Python 3, you have to install "MySQL-for-Python-3":
MySQL-for-Python-3 can be installed from below repository.
pip3 install --user https://github.com/davispuh/MySQL-for-Python-3/archive/1.0.tar.gz

No comments:
Post a Comment