Skip to content

Instantly share code, notes, and snippets.

@myusuf3
Created September 14, 2011 02:14
Show Gist options
  • Save myusuf3/1215703 to your computer and use it in GitHub Desktop.
Save myusuf3/1215703 to your computer and use it in GitHub Desktop.
connecting to database with mysql
# First you will need to install python drivers for mysql
sudo apt-get install python-mysqldb
# Now go to your settings.py, enter the credentials you setup during the database creation process of the tutorial
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'testdb',# Or path to database file if using sqlite3.
'USER': 'testuser', # Not used with sqlite3.
'PASSWORD': 'password', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
# you can now run syncdb from the manage.py and it should connect and create the appropriate tables for you! :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment