Skip to content

Commit

Permalink
依赖配置没有时自动跳转到相关配置页面
Browse files Browse the repository at this point in the history
docker宿主机端口支持自定义
  • Loading branch information
lihuanhuan committed Apr 16, 2018
1 parent e454034 commit b71ea7d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
15 changes: 4 additions & 11 deletions sql/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ def allworkflow(request):
def submitSql(request):
masters = master_config.objects.all().order_by('cluster_name')
if len(masters) == 0:
context = {'errMsg': '请先配置主库信息'}
return render(request, 'error.html', context)
return HttpResponseRedirect('/admin/sql/master_config/add/')

#获取所有集群名称
listAllClusterName = [master.cluster_name for master in masters]
Expand All @@ -139,9 +138,6 @@ def submitSql(request):
#获取所有审核人
loginUser = request.session.get('login_username', False)
reviewMen = users.objects.filter(role='审核人')
if len(reviewMen) == 0:
context = {'errMsg': '请先配置审核人'}
return render(request, 'error.html', context)
listAllReviewMen = [user.username for user in reviewMen]

context = {'currentMenu':'submitsql', 'dictAllClusterDb':dictAllClusterDb, 'reviewMen':reviewMen}
Expand Down Expand Up @@ -434,8 +430,7 @@ def sqlquery(request):
# 获取所有从库集群名称
slaves = slave_config.objects.all().order_by('cluster_name')
if len(slaves) == 0:
context = {'errMsg': '请先配置从库信息'}
return render(request, 'error.html', context)
return HttpResponseRedirect('/admin/sql/slave_config/add/')
listAllClusterName = [slave.cluster_name for slave in slaves]

context = {'currentMenu': 'sqlquery', 'listAllClusterName': listAllClusterName}
Expand All @@ -446,8 +441,7 @@ def slowquery(request):
# 获取所有集群主库名称
masters = master_config.objects.all().order_by('cluster_name')
if len(masters) == 0:
context = {'errMsg': '请先配置主库信息'}
return render(request, 'error.html', context)
return HttpResponseRedirect('/admin/sql/master_config/add/')
cluster_name_list = [master.cluster_name for master in masters]

context = {'currentMenu': 'slowquery', 'tab': 'slowquery', 'cluster_name_list': cluster_name_list}
Expand All @@ -458,8 +452,7 @@ def sqladvisor(request):
# 获取所有集群主库名称
masters = master_config.objects.all().order_by('cluster_name')
if len(masters) == 0:
context = {'errMsg': '请先配置主库信息'}
return render(request, 'error.html', context)
return HttpResponseRedirect('/admin/sql/master_config/add/')
cluster_name_list = [master.cluster_name for master in masters]

context = {'currentMenu': 'sqladvisor', 'listAllClusterName': cluster_name_list}
Expand Down
2 changes: 1 addition & 1 deletion src/docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ http {
location / {
proxy_pass http://127.0.0.1:8888;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host:9123;
proxy_set_header X-Forwarded-Host $host:nginx_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
Expand Down
5 changes: 3 additions & 2 deletions src/docker/startup.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash

cd /opt/archer
# 切换python运行环境
#切换python运行环境
source /opt/venv4archer/bin/activate
#启动ngnix
#修改重定向端口,启动ngnix
sed -i "s/nginx_port/$NGINX_PORT/g" /etc/nginx/nginx.conf
/usr/sbin/nginx

#收集所有的静态文件到STATIC_ROOT
Expand Down

0 comments on commit b71ea7d

Please sign in to comment.