From ab09fbfc1bb0574ed4b33699e51654c89fce1a89 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 10 Nov 2021 09:33:06 -0500 Subject: [PATCH] Added mysql support in production --- CodeReview/settings.py | 14 +++++++++++++- README.md | 2 +- requirements.txt | Bin 452 -> 270 bytes 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CodeReview/settings.py b/CodeReview/settings.py index 29614e5..672a6ac 100644 --- a/CodeReview/settings.py +++ b/CodeReview/settings.py @@ -79,7 +79,19 @@ TEMPLATES = [ WSGI_APPLICATION = 'CodeReview.wsgi.application' # This next block of code defines how our database will work and what database system will work -if STAGE == "GH_TEST": +if STAGE == "Prod": + # In production, we use MySQl as our database backend + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'CodeReview', + 'USER': os.getenv("DB_USERNAME", ""), + 'PASSWORD': os.getenv("DB_PASSWORD", ""), + 'HOST': os.getenv("DB_HOST", "localhost"), + 'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"} + } + } +elif STAGE == "GH_TEST": # In GitHub testing, we use Postgre as a database backend DATABASES = { 'default': { diff --git a/README.md b/README.md index d7b5990..c717261 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ review, the instructor will get a final email with the notes the senior has give - EMAIL_DOMAIN: The domain to use when generating student emails - EMAIL_ADMIN_DOMAIN: The domain to use when generating instructor emails - DB_HOST: The host for the database we'll use (MySQL Type) -- DB_NAME: The name for the DB we'll use +- DB_USERNAME: The name for the DB we'll use - DB_PASS: The password for the DB we'll use - LDAP_URL: The URL of the ActiveDirectory Server we want to use for auth - LDAP_DOMAIN: The domain to use when logging users in diff --git a/requirements.txt b/requirements.txt index 5906012c004fb3b9e765acb7680f9d3c28cb7f1a..b93f88d3d53321722099c7e8cc3304ac50f9631e 100644 GIT binary patch literal 270 zcmYZ*PR}e#O|!KH%vjGv&yXvzq@<|W*4D^S&q&XJ%Oxu@FFhY5XQXGzl>+AJrlcm7 zrt6mE=jS9P7D42UU~;*MnK`LNwzfukhFqDs1^GoKIhjeiMXAO4rA5i9#kRJldM0`X zTv^5WdBw>Yskw=^wkCQY#W^X71;!wKmU@O74CxHI3?&Tt4EYQ> z3`q=$3`Hn9jj-s0RRfY@}@UQ}@D`BVt%Na2kFhIi67;Hu{LncE7SOyfn ch74wKUBwKA3^@!1;BYEtNCm5b*$;6Y0Ph?@H2?qr -- knotmirror 0.0.1