Hi! I just wanted to know how you configure the DATABASE part of settings.py to work with the free mySQL database that we are provided. Any help would be appreciated in this matter. So far, I've been able to do with sqlite, but I want to learn how to work with MySQL, so the a short tutorial on how to handle the configurations would be awesome.
This is my current configuration:
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
def replace(path):
assert isinstance(path, str)
return path.replace('\\', os.sep)
def here(*args):
return replace(os.path.abspath(os.path.join(os.path.dirname(__file__), *args)))
BASE_DIR = here('..')
def root(*args):
return replace(os.path.abspath(os.path.join(BASE_DIR, *args)))
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': root('myblog.db'), # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': '',
'PASSWORD': '',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}