mirror of https://github.com/jumpserver/jumpserver
[Update] 修改 运行脚本
parent
209200dc4f
commit
8b081cd6b0
|
@ -242,8 +242,8 @@ LOGGING = {
|
||||||
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
||||||
LANGUAGE_CODE = 'en-us'
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
# TIME_ZONE = 'UTC'
|
||||||
# TIME_ZONE = 'Asia/Shanghai'
|
TIME_ZONE = 'Asia/Shanghai'
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ CELERY_RESULT_EXPIRES = 3600
|
||||||
CELERY_WORKER_LOG_FORMAT = '%(asctime)s [%(module)s %(levelname)s] %(message)s'
|
CELERY_WORKER_LOG_FORMAT = '%(asctime)s [%(module)s %(levelname)s] %(message)s'
|
||||||
CELERY_WORKER_TASK_LOG_FORMAT = '%(asctime)s [%(module)s %(levelname)s] %(message)s'
|
CELERY_WORKER_TASK_LOG_FORMAT = '%(asctime)s [%(module)s %(levelname)s] %(message)s'
|
||||||
CELERY_TASK_EAGER_PROPAGATES = True
|
CELERY_TASK_EAGER_PROPAGATES = True
|
||||||
CELERY_TIMEZONE = TIME_ZONE
|
# CELERY_TIMEZONE = TIME_ZONE
|
||||||
# CELERY_ENABLE_UTC = True
|
# CELERY_ENABLE_UTC = True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ def start_gunicorn():
|
||||||
def start_celery():
|
def start_celery():
|
||||||
print("- Start Celery as Distributed Task Queue")
|
print("- Start Celery as Distributed Task Queue")
|
||||||
os.chdir(APPS_DIR)
|
os.chdir(APPS_DIR)
|
||||||
# Todo: Must set this environment, if not no ansible result return
|
# Todo: Must set this environment, otherwise not no ansible result return
|
||||||
os.environ.setdefault('PYTHONOPTIMIZE', '1')
|
os.environ.setdefault('PYTHONOPTIMIZE', '1')
|
||||||
cmd = 'celery -A common worker -l {}'.format(LOG_LEVEL.lower())
|
cmd = 'celery -A common worker -l {}'.format(LOG_LEVEL.lower())
|
||||||
subprocess.call(cmd, shell=True)
|
subprocess.call(cmd, shell=True)
|
||||||
|
@ -55,24 +55,8 @@ def make_migrations():
|
||||||
subprocess.call('bash make_migrations.sh', shell=True)
|
subprocess.call('bash make_migrations.sh', shell=True)
|
||||||
|
|
||||||
|
|
||||||
def load_init_data():
|
|
||||||
print("Load init data, if need")
|
|
||||||
os.chdir(APPS_DIR)
|
|
||||||
print(os.listdir(APPS_DIR))
|
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'jumpserver.settings'
|
|
||||||
from users.models import User
|
|
||||||
|
|
||||||
was_initial = User.objects.all().count()
|
|
||||||
if not was_initial:
|
|
||||||
os.chdir(os.path.join(BASE_DIR, 'utils'))
|
|
||||||
subprocess.call('bash init_db.sh', shell=True)
|
|
||||||
else:
|
|
||||||
print("Has been initial, pass")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
make_migrations()
|
make_migrations()
|
||||||
load_init_data()
|
|
||||||
|
|
||||||
print(time.ctime())
|
print(time.ctime())
|
||||||
print('Jumpserver version {}, more see https://www.jumpserver.org'.format(
|
print('Jumpserver version {}, more see https://www.jumpserver.org'.format(
|
||||||
|
|
Loading…
Reference in New Issue