Created
September 14, 2011 02:14
-
-
Save myusuf3/1215703 to your computer and use it in GitHub Desktop.
connecting to database with mysql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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