Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hunter-ht.cn
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘莹莹
hunter-ht.cn
Commits
f255bf7a
Commit
f255bf7a
authored
May 12, 2020
by
Xu Zhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using env for mysql pass.
parent
6822f3a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
settings.cpython-37.pyc
Hunter_ht/__pycache__/settings.cpython-37.pyc
+0
-0
settings.py
Hunter_ht/settings.py
+13
-2
No files found.
Hunter_ht/__pycache__/settings.cpython-37.pyc
deleted
100644 → 0
View file @
6822f3a7
File deleted
Hunter_ht/settings.py
View file @
f255bf7a
...
...
@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import
os
import
sys
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
...
...
@@ -74,13 +75,23 @@ WSGI_APPLICATION = 'Hunter_ht.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
def
get_env_value
(
env_variable
):
try
:
return
os
.
environ
[
env_variable
]
except
KeyError
:
error_msg
=
'Set the {} environment variable'
.
format
(
env_variable
)
print
(
error_msg
)
sys
.
exit
(
-
1
)
MYSQL_USER
=
get_env_value
(
'MYSQL_USER'
)
MYSQL_PASS
=
get_env_value
(
'MYSQL_PASS'
)
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.mysql'
,
'NAME'
:
'HUNTER'
,
'USER'
:
'root'
,
'PASSWORD'
:
'mysql'
,
'USER'
:
MYSQL_USER
,
'PASSWORD'
:
MYSQL_PASS
,
'HOST'
:
'localhost'
,
'PORT'
:
'3306'
,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment