diff --git a/devsite/.env.example b/devsite/.env.example index ea6154dd..9a381bfc 100644 --- a/devsite/.env.example +++ b/devsite/.env.example @@ -5,6 +5,13 @@ # Django development debug mode DEBUG=true +# Set a database to use with devsite +# The default database is SQLite and assigned in devsite/settings.py +# Use this specific string if you want to run Figures with MySQL Docker +# For more details, read the django-environ README +# https://github.com/joke2k/django-environ/blob/v0.4.5/README.rst +DATABASE_URL=mysql://figures_user:drowssap-ekaf@127.0.0.1:3306/figures-db + # Set which expected Open edX release mocks for devsite to use. # Valid options are: "GINKGO", "HAWTHORN", "JUNIPER" # diff --git a/devsite/devsite/settings.py b/devsite/devsite/settings.py index 08b538f8..1f0e7a43 100644 --- a/devsite/devsite/settings.py +++ b/devsite/devsite/settings.py @@ -160,20 +160,21 @@ WSGI_APPLICATION = 'devsite.wsgi.application' -# Database -# https://docs.djangoproject.com/en/1.8/ref/settings/#databases + +# Database setting +# To select a different database, such as MySQL, add the database url string to +# as 'DATABASE_URL=' in the devsite/.env file +# +# Refs: +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases +# https://github.com/joke2k/django-environ/tree/v0.4.5 + +DEFAULT_SQLITE_DB_URL = os.path.join(DEVSITE_BASE_DIR, + 'figures-{release}-db.sqlite3'.format( + release=OPENEDX_RELEASE.lower())) DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(DEVSITE_BASE_DIR, - 'figures-{release}-db.sqlite3'.format( - release=OPENEDX_RELEASE.lower())), - 'USER': '', - 'PASSWORD': '', - 'HOST': '', - 'PORT': '', - } + 'default': env.db(default=DEFAULT_SQLITE_DB_URL) } LOCALE_PATHS = [