Tide user and web code

This commit is contained in:
zhuyj17 2018-06-11 00:14:41 +08:00
parent 1315ca0c3a
commit 95ab1104f4
5 changed files with 15 additions and 15 deletions

View File

@ -13,12 +13,7 @@ src_folder = os.path.realpath(os.path.abspath(os.path.join(this_folder,"..", "sr
if src_folder not in sys.path:
sys.path.insert(0, src_folder)
# must first init loadenv
from log import initlogging
initlogging("docklet-user")
from log import logger
import tools, env
from utils import tools, env
config = env.getenv("CONFIG")
tools.loadenv(config)
masterips = env.getenv("MASTER_IPS").split(",")
@ -26,14 +21,19 @@ G_masterips = []
for masterip in masterips:
G_masterips.append(masterip.split("@")[0] + ":" + str(env.getenv("MASTER_PORT")))
# must first init loadenv
from utils.log import initlogging
initlogging("docklet-user")
from utils.log import logger
from flask import Flask, request, session, render_template, redirect, send_from_directory, make_response, url_for, abort
from functools import wraps
import userManager,beansapplicationmgr, notificationmgr, lockmgr
from master import userManager,beansapplicationmgr, notificationmgr, lockmgr
import threading,traceback
from model import User,db
from utils.model import User,db
from httplib2 import Http
from urllib.parse import urlencode
from settings import settings
from master.settings import settings
external_login = env.getenv('EXTERNAL_LOGIN')
if(external_login == 'TRUE'):

View File

@ -12,7 +12,7 @@ if src_folder not in sys.path:
sys.path.insert(0, src_folder)
# must first init loadenv
import tools, env
from utils import tools, env
config = env.getenv("CONFIG")
tools.loadenv(config)

View File

@ -13,7 +13,7 @@ src_folder = os.path.realpath(os.path.abspath(os.path.join(this_folder,"../../..
if src_folder not in sys.path:
sys.path.insert(0, src_folder)
import env
from utils import env
if (env.getenv('EXTERNAL_LOGIN') == 'True'):
sys.path.insert(0, os.path.realpath(os.path.abspath(os.path.join(this_folder,"../../../src", "plugin"))))
@ -140,7 +140,7 @@ class external_login_callbackView(normalView):
class external_loginView(normalView):
if (env.getenv('EXTERNAL_LOGIN') == 'True'):
template_path = external_generate.html_path
@classmethod
def post(self):
return render_template(self.template_path)

View File

@ -9,7 +9,7 @@ src_folder = os.path.realpath(os.path.abspath(os.path.join(this_folder,"../..",
if src_folder not in sys.path:
sys.path.insert(0, src_folder)
import env
from utils import env
masterips=env.getenv('MASTER_IPS').split(",")
user_endpoint = "http://" + env.getenv('USER_IP') + ":" + str(env.getenv('USER_PORT'))
@ -60,7 +60,7 @@ class dockletRequest():
return result
#except:
#abort(500)
@classmethod
def getdesc(self,mastername):
return env.getenv(mastername+"_desc")[1:-1]

View File

@ -12,7 +12,7 @@ this_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(ins
src_folder = os.path.realpath(os.path.abspath(os.path.join(this_folder,"../..", "src")))
if src_folder not in sys.path:
sys.path.insert(0, src_folder)
import env
from utils import env
# logger should only be imported after initlogging has been called
logger = None