Skip to content

Instantly share code, notes, and snippets.

@shady-robot
Last active May 12, 2016 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shady-robot/5a2e3995bbb6e1433392736d146b004e to your computer and use it in GitHub Desktop.
Save shady-robot/5a2e3995bbb6e1433392736d146b004e to your computer and use it in GitHub Desktop.
Settings in django
How to install mysql-client to connect django and MySQL:
(1). Make sure the MySQL is installed
(2). Use the following command to install the package:
Ubuntu:
$sudo apt-get install libmysqlclient-dev
CentOS:
$ sudo apt-get install mysql-devel
(3). inside the virtualenv
$ pip3 install mysqlclient
(4). The database connection parameters setting
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'DB_NAME',
'USER': 'DB_USER',
'PASSWORD': 'DB_PASSWORD',
'HOST': 'localhost', # Or an IP Address that your DB is hosted on
'PORT': '3306',
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment