-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Setting] Database supports MySQL (#57)
* separate settings files into debug and deploy * django settings sonar exclustions * mysql setting
- Loading branch information
1 parent
64a321f
commit cb06ff0
Showing
13 changed files
with
106 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,4 +86,5 @@ __pycache__/ | |
local_settings.py | ||
|
||
.env | ||
.config/ | ||
db.sqlite3 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"django": { | ||
"secret_key": "swpp2019-team6" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"django": { | ||
"allowed_hosts": [ | ||
"localhost", | ||
"127.0.0.1" | ||
] | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"django": { | ||
"allowed_hosts": [ | ||
"localhost", | ||
"127.0.0.1" | ||
], | ||
"secret_key": "SECRET_KEY", | ||
"database": { | ||
"NAME": "SCHEMA", | ||
"USER": "USER", | ||
"PASSWORD": "PASSWORD", | ||
"HOST": "HOST", | ||
"PORT": 3306 | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Empty file.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from .base import * | ||
|
||
config_debug = json.loads(open(CONFIG_DEBUG_FILE).read()) | ||
|
||
DEBUG = True | ||
|
||
ALLOWED_HOSTS = config_debug['django']['allowed_hosts'] | ||
|
||
WSGI_APPLICATION = 'triplannet.wsgi.debug.application' | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': pjoin(BASE_DIR, 'db.sqlite3'), | ||
} | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from .base import * | ||
|
||
config_deploy = json.loads(open(CONFIG_DEPLOY_FILE).read()) | ||
|
||
DEBUG = False | ||
|
||
ALLOWED_HOSTS = config_deploy['django']['allowed_hosts'] | ||
|
||
WSGI_APPLICATION = 'triplannet.wsgi.deploy.application' | ||
|
||
SECRET_KEY = config_deploy['django']['secret_key'] | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.mysql', | ||
'NAME': config_deploy['django']['database']['NAME'], | ||
'USER': config_deploy['django']['database']['USER'], | ||
'PASSWORD': config_deploy['django']['database']['PASSWORD'], | ||
'HOST': config_deploy['django']['database']['HOST'], | ||
'PORT': config_deploy['django']['database']['PORT'], | ||
'OPTIONS': { | ||
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'" | ||
} | ||
} | ||
} | ||
|
Empty file.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
WSGI config for triplannet project. | ||
It exposes the WSGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.wsgi import get_wsgi_application | ||
|
||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'triplannet.settings.deploy') | ||
|
||
application = get_wsgi_application() |