Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
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
ops
jumpserver
Commits
a2f23e96
Commit
a2f23e96
authored
Jun 08, 2018
by
梁志艳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增Redis DB配置
parent
4c8eb4a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
settings.py
apps/jumpserver/settings.py
+4
-2
config_example.py
config_example.py
+13
-11
No files found.
apps/jumpserver/settings.py
View file @
a2f23e96
...
@@ -343,10 +343,11 @@ if AUTH_LDAP:
...
@@ -343,10 +343,11 @@ if AUTH_LDAP:
AUTHENTICATION_BACKENDS
.
insert
(
0
,
AUTH_LDAP_BACKEND
)
AUTHENTICATION_BACKENDS
.
insert
(
0
,
AUTH_LDAP_BACKEND
)
# Celery using redis as broker
# Celery using redis as broker
CELERY_BROKER_URL
=
'redis://:
%(password)
s@
%(host)
s:
%(port)
s/
3
'
%
{
CELERY_BROKER_URL
=
'redis://:
%(password)
s@
%(host)
s:
%(port)
s/
%(db)
s
'
%
{
'password'
:
CONFIG
.
REDIS_PASSWORD
if
CONFIG
.
REDIS_PASSWORD
else
''
,
'password'
:
CONFIG
.
REDIS_PASSWORD
if
CONFIG
.
REDIS_PASSWORD
else
''
,
'host'
:
CONFIG
.
REDIS_HOST
or
'127.0.0.1'
,
'host'
:
CONFIG
.
REDIS_HOST
or
'127.0.0.1'
,
'port'
:
CONFIG
.
REDIS_PORT
or
6379
,
'port'
:
CONFIG
.
REDIS_PORT
or
6379
,
'db'
:
CONFIG
.
REDIS_DB_CELERY_BROKER
or
3
,
}
}
CELERY_TASK_SERIALIZER
=
'pickle'
CELERY_TASK_SERIALIZER
=
'pickle'
CELERY_RESULT_SERIALIZER
=
'pickle'
CELERY_RESULT_SERIALIZER
=
'pickle'
...
@@ -367,10 +368,11 @@ CELERY_WORKER_HIJACK_ROOT_LOGGER = False
...
@@ -367,10 +368,11 @@ CELERY_WORKER_HIJACK_ROOT_LOGGER = False
CACHES
=
{
CACHES
=
{
'default'
:
{
'default'
:
{
'BACKEND'
:
'redis_cache.RedisCache'
,
'BACKEND'
:
'redis_cache.RedisCache'
,
'LOCATION'
:
'redis://:
%(password)
s@
%(host)
s:
%(port)
s/
4
'
%
{
'LOCATION'
:
'redis://:
%(password)
s@
%(host)
s:
%(port)
s/
%(db)
s
'
%
{
'password'
:
CONFIG
.
REDIS_PASSWORD
if
CONFIG
.
REDIS_PASSWORD
else
''
,
'password'
:
CONFIG
.
REDIS_PASSWORD
if
CONFIG
.
REDIS_PASSWORD
else
''
,
'host'
:
CONFIG
.
REDIS_HOST
or
'127.0.0.1'
,
'host'
:
CONFIG
.
REDIS_HOST
or
'127.0.0.1'
,
'port'
:
CONFIG
.
REDIS_PORT
or
6379
,
'port'
:
CONFIG
.
REDIS_PORT
or
6379
,
'db'
:
CONFIG
.
REDIS_DB_CACHE
or
4
,
}
}
}
}
}
}
...
...
config_example.py
View file @
a2f23e96
...
@@ -21,10 +21,10 @@ class Config:
...
@@ -21,10 +21,10 @@ class Config:
ALLOWED_HOSTS
=
[
'*'
]
ALLOWED_HOSTS
=
[
'*'
]
# Development env open this, when error occur display the full process track, Production disable it
# Development env open this, when error occur display the full process track, Production disable it
DEBUG
=
True
DEBUG
=
os
.
environ
.
get
(
"DEBUG"
)
or
True
# DEBUG, INFO, WARNING, ERROR, CRITICAL can set. See https://docs.djangoproject.com/en/1.10/topics/logging/
# DEBUG, INFO, WARNING, ERROR, CRITICAL can set. See https://docs.djangoproject.com/en/1.10/topics/logging/
LOG_LEVEL
=
'DEBUG'
LOG_LEVEL
=
os
.
environ
.
get
(
"LOG_LEVEL"
)
or
'DEBUG'
LOG_DIR
=
os
.
path
.
join
(
BASE_DIR
,
'logs'
)
LOG_DIR
=
os
.
path
.
join
(
BASE_DIR
,
'logs'
)
# Database setting, Support sqlite3, mysql, postgres ....
# Database setting, Support sqlite3, mysql, postgres ....
...
@@ -35,12 +35,12 @@ class Config:
...
@@ -35,12 +35,12 @@ class Config:
DB_NAME
=
os
.
path
.
join
(
BASE_DIR
,
'data'
,
'db.sqlite3'
)
DB_NAME
=
os
.
path
.
join
(
BASE_DIR
,
'data'
,
'db.sqlite3'
)
# MySQL or postgres setting like:
# MySQL or postgres setting like:
# DB_ENGINE = 'mysql'
# DB_ENGINE =
os.environ.get("DB_ENGINE") or
'mysql'
# DB_HOST = '127.0.0.1'
# DB_HOST =
os.environ.get("DB_HOST") or
'127.0.0.1'
# DB_PORT = 3306
# DB_PORT =
os.environ.get("DB_PORT") or
3306
# DB_USER =
'root
'
# DB_USER =
os.environ.get("DB_USER") or 'jumpserver
'
# DB_PASSWORD =
'
'
# DB_PASSWORD =
os.environ.get("DB_PASSWORD") or 'weakPassword
'
# DB_NAME = 'jumpserver'
# DB_NAME =
os.environ.get("DB_NAME") or
'jumpserver'
# When Django start it will bind this host and port
# When Django start it will bind this host and port
# ./manage.py runserver 127.0.0.1:8080
# ./manage.py runserver 127.0.0.1:8080
...
@@ -48,9 +48,11 @@ class Config:
...
@@ -48,9 +48,11 @@ class Config:
HTTP_LISTEN_PORT
=
8080
HTTP_LISTEN_PORT
=
8080
# Use Redis as broker for celery and web socket
# Use Redis as broker for celery and web socket
REDIS_HOST
=
'127.0.0.1'
REDIS_HOST
=
os
.
environ
.
get
(
"REDIS_HOST"
)
or
'127.0.0.1'
REDIS_PORT
=
6379
REDIS_PORT
=
os
.
environ
.
get
(
"REDIS_PORT"
)
or
6379
REDIS_PASSWORD
=
''
REDIS_PASSWORD
=
os
.
environ
.
get
(
"REDIS_PASSWORD"
)
or
''
REDIS_DB_CELERY
=
os
.
environ
.
get
(
'REDIS_DB'
)
or
3
REDIS_DB_CACHE
=
os
.
environ
.
get
(
'REDIS_DB'
)
or
4
def
__init__
(
self
):
def
__init__
(
self
):
pass
pass
...
...
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