def register(): form = RegisterForm(request.form) msg = None if 'username' in session: return redirect(url_for('index_admin')) if request.method == 'GET': return render_template('admin/pages/register.html', form=form, msg=msg) if form.validate_on_submit(): username = request.form['username'] password = request.form['password'] modeluser = Model() account = modeluser.validate_account(username) if account: msg = "Username is exist. Please try other username." return render_template('admin/pages/register.html', form=form, msg=msg) else: modeluser.save_account(username, password) return redirect(url_for('login')) else: msg = 'Input error' return render_template('admin/pages/register.html', form=form, msg=msg)
def table_cluster(): if request.data: username = json.loads(request.data).get('username') try: if session['username'] == username: modelcluster = Model() result = modelcluster.select_cluster() data = {} data.setdefault('data', result) modelcluster.close_connection() return jsonify(data) else: return redirect(url_for('login')) except Exception as error: print(error) return redirect(url_for('login')) else: return redirect(url_for('login'))
def teacher_detail(t_id, school): app.config['SQLALCHEMY_DATABASE_URI'] = app.config['SQLALCHEMY_DATABASE_URI_BASE'] + school model = Model() timestamp = datetime.now() if request.method == 'GET': teacher = model.get_teacher_detail(t_id) ip = request.remote_addr if not teacher: return render_template('404.html', timestamp=timestamp) cmts = model.get_teacher_cmts(teacher.id) pop_cmts = order_cmts_by_up_vote(cmts) if cmts else [] new_cmts = order_cmts_by_time(cmts) if cmts else [] pop_cmts = get_unique_cmts(pop_cmts) new_cmts = get_unique_cmts(new_cmts) pop_cmts_methods = [model.get_vote_method(ip, cmt.id) for cmt in pop_cmts] new_cmts_methods = [model.get_vote_method(ip, cmt.id) for cmt in new_cmts] return render_template('info.html', teacher=teacher, pop_cmts=pop_cmts, new_cmts=new_cmts, pop_cmts_methods=pop_cmts_methods, new_cmts_methods=new_cmts_methods, timestamp=timestamp) if request.method == 'POST': # 添加关于这个教师的评论 ip = request.remote_addr content = request.form['content'].strip(' ') if len(content) > 340: return 'long' # content longer than 340 point = request.form['point'] point = int(point) current_time = datetime.now() res = model.add_cmt(content, current_time, point, t_id, ip) if not res: return 'not exist' # teacher not exist return 'ok'
def delete_keyword(): if request.data: username = json.loads(request.data).get('username') keyword = json.loads(request.data).get('keyword') try: if session['username'] == username: modeltwitter = Model() result = modeltwitter.delete_keyword_twitter(keyword) data = {} data.setdefault('succes', True) modeltwitter.close_connection() return jsonify(data) else: return redirect(url_for('login')) except Exception as error: print(error) return redirect(url_for('login')) else: return redirect(url_for('login'))
def edit_kbba(): if request.data: username = json.loads(request.data).get('username') alay_before = json.loads(request.data).get('alay_before') alay_after = json.loads(request.data).get('alay_after') baku_before = json.loads(request.data).get('baku_before') baku_after = json.loads(request.data).get('baku_after') try: if session['username'] == username: modelkbba = Model() result = modelkbba.edit_kbba(alay_after, baku_after, alay_before, baku_before) modelkbba.close_connection() return jsonify(result) else: return redirect(url_for('login')) except Exception as error: print(error) return redirect(url_for('login')) else: return redirect(url_for('login'))
def visualitation(): if 'username' not in session: return redirect(url_for('login')) modeltraining = Model() list_keyword = modeltraining.select_model_keyword() modeltraining.close_connection() return render_template('admin/pages/visualitation.html', keyword=list_keyword, username=session['username'])
def cmt_detail(cmt_id, school): app.config['SQLALCHEMY_DATABASE_URI'] = app.config['SQLALCHEMY_DATABASE_URI_BASE'] + school model = Model() timestamp = datetime.now() ip = request.remote_addr cmt = model.get_cmt_by_id(cmt_id) if not cmt: abort(404) method = model.get_vote_method(ip, cmt_id) teacher_id = model.get_teacher_by_cmt_id(cmt_id) return render_template('comment.html', cmt=cmt, method=method, teacher_id=teacher_id, timestamp=timestamp)
def backgroundprocess_training(username, keyword, centroid, cluster, iteration, k=3): model_vocabulary = Model() total_tweets, data = model_vocabulary.select_data_training(keyword) list_id = [x['id'] for x in data] list_preprocessing = [x['tfidf'] for x in data] kmeans = KMeans(model_vocabulary) status = kmeans.fit(keyword, list_id, centroid, cluster, list_preprocessing, total_tweets, k, iteration) chache[username]['statustraining'] = status
def add_teacher(school): app.config['SQLALCHEMY_DATABASE_URI'] = app.config['SQLALCHEMY_DATABASE_URI_BASE'] + school timestamp = datetime.now() if request.method == 'GET': m = Model() depts = m.get_dept_lst() depts = m.get_dept_list_new() school_name = app.config['SCHOOL_REL'][school] # print school_name return render_template('add.html', depts=depts, timestamp=timestamp, school=school_name) if request.method == 'POST': name = request.form['name'] name = name.strip(' ') if name == '': return 'name invalid' school = request.form['school'] dept_id = request.form['dept_name'] m = Model() t_id = m.teacher_exist(name, school, dept_id) if t_id: return 'teacher exists' else: m.add_teacher(name, school, dept_id) t_id = m.teacher_exist(name, school, dept_id) # 获得新插入老师id print request.remote_addr return str(t_id)
def search_teacher(school): app.config['SQLALCHEMY_DATABASE_URI'] = app.config['SQLALCHEMY_DATABASE_URI_BASE'] + school model = Model() timestamp = datetime.now() name = request.args.get('search-content', '') name = name.strip(' ') # 当作姓名搜索 teachers_by_name = model.get_teachers_by_name(name) # 当作院系搜索 teachers_by_dept = model.get_teacher_by_dept_name(name) teachers_by_dept = order_teacher_by_cmt_num(teachers_by_dept) teachers = teachers_by_dept + teachers_by_name return render_template('result.html', teachers=teachers, timestamp=timestamp)
def books_list(): # 获取关键字 keywords = request.args.get('keywords', None) if keywords: print("有keywords:") print(keywords) # 搜素书籍信息 data = Model().query('select * from wxapp.books where title like "' + keywords + '"') else: # 获取当前所有书籍信息,并返回json数据 data = Model().query('select * from wxapp.books') print(data) return jsonify(data)
def crawling(self, keyword, startdate, enddate, maxtweet): model_crawling = Model() if startdate and enddate and maxtweet > 0: tweetCriteria = got.manager.TweetCriteria().setQuerySearch( keyword).setSince(startdate).setUntil(enddate).setMaxTweets( maxtweet) elif startdate and enddate and maxtweet < 1: tweetCriteria = got.manager.TweetCriteria().setQuerySearch( keyword).setSince(startdate).setUntil(enddate) elif startdate and not enddate and maxtweet > 0: tweetCriteria = got.manager.TweetCriteria().setQuerySearch( keyword).setSince(startdate).setMaxTweets(maxtweet) elif enddate and not startdate and maxtweet > 0: tweetCriteria = got.manager.TweetCriteria().setQuerySearch( keyword).setUntil(startdate).setMaxTweets(maxtweet) elif startdate and not enddate and maxtweet < 1: tweetCriteria = got.manager.TweetCriteria().setQuerySearch( keyword).setUntil(startdate) elif enddate and not startdate and maxtweet < 1: tweetCriteria = got.manager.TweetCriteria().setQuerySearch( keyword).setUntil(startdate) else: print(keyword, startdate, enddate, maxtweet) tweetCriteria = got.manager.TweetCriteria().setQuerySearch(keyword) tweets = got.manager.TweetManager.getTweets(tweetCriteria) for tweet in tweets: content = tweet.text content = content.strip() tweetdate = tweet.date isnews = self.check_isnews(content) if not isnews: model_crawling.save_tweet(content, keyword, tweetdate)
def create_model(): form = Form(request.form) del form.delete if request.method == 'POST' and form.validate(): new_el = Model() for field in form: if field.type == "SubmitField": continue if field.data == "": continue setattr(new_el, field.name.lower(), field.data) db_session.add(new_el) try: db_session.commit() except (sqlalchemy.exc.IntegrityError, sqlalchemy.orm.exc.FlushError) as e: flash(str(e), "danger") return redirect(url_for(".view_all")) return render_template("form_view.html", title=title, form=form)
def test_add_model_and_create_organism(self): organism_name = 'E coli' model_name = 'E coli - test' model_strain = 'MG16555' model_comments = 'just testing' organism = Organism.query.filter_by(name=organism_name).first() if not organism: organism = Organism(name=organism_name) db.session.add(organism) model = Model(name=model_name, organism_name=organism_name, strain=model_strain, comments=model_comments) db.session.add(model) organism.add_model(model) db.session.commit() self.assertEqual(organism.query.first().name, organism_name) self.assertEqual(organism.models.first().name, model_name) self.assertEqual(model.query.first().name, model_name) self.assertEqual(model.query.first().strain, model_strain) self.assertEqual(model.query.first().comments, model_comments)
def test_add_model_for_existing_organism(self): organism_name = 'E coli' model_name = 'E coli - test' model_strain = 'MG16555' model_comments = 'just testing' organism = Organism(name=organism_name) db.session.add(organism) db.session.commit() self.assertEqual(organism.query.first().name, organism_name) self.assertEqual(organism.query.first().models.count(), 0) model = Model(name=model_name, organism_name=organism_name, strain=model_strain, comments=model_comments) db.session.add(model) organism.add_model(model) db.session.commit() self.assertEqual(organism.query.first().models.count(), 1) self.assertEqual(organism.query.first().models[0].name, model_name) self.assertEqual(model.query.first().name, model_name) self.assertEqual(model.query.first().strain, model_strain) self.assertEqual(model.query.first().comments, model_comments) self.assertEqual(model.query.first().organism.name, organism_name)
def add_models(): model_list = [('E. coli - iteration 1', 'E. coli', 'MG16555'), ('E. coli - iteration 2', 'E. coli', 'MG16555')] for name, organism_name, strain in model_list: model = Model(name=name, organism_name=organism_name, strain=strain) db.session.add(model) db.session.commit()
def get_borrow(): # 获取用户id userid = request.args.get('userid') # 获取当前用户的借阅信息 sql = 'select bw.*,books.title,books.pic_url,books.author,books.price,books.publisher from borrow as bw inner join books on bw.book_isbn = books.isbn13 where bw.user_id = {user_id}'.format( user_id=userid) res = Model().query(sql) return jsonify(res)
def register(): # 获取 code code = request.args.get('code') # 向微信服务器发请求 获取 openid # GET wxurl = ''' https://api.weixin.qq.com/sns/jscode2session?appid={APPID}&secret={SECRET}&js_code={JSCODE}&grant_type=authorization_code '''.format(APPID=app.config['APPID'], SECRET=app.config['SECRET'], JSCODE=code) # 向微信服务器发起请求,获取openid req = urllib.request.urlopen(url=wxurl) # 获取接口响应的内容 content = req.read() resdata = json.loads(content.decode('utf-8')) # {'session_key': 'B4RnIIYNQNPa3+hCWexeYg==', # 'openid': 'oo-ye4riGgJLZzdLA6cZu-3f8o-E'} # 判断openid是否存在 print('-' * 50) print(resdata) print('-' * 50) sql = 'select * from users where openid="{}"'.format(resdata['openid']) fromres = Model().query(sql) if fromres: # 存在,则返回 return jsonify({'msg': '用户已经存在', 'code': fromres[0]['id']}) # 不存在,则添加 # 接收数据 userdata = json.loads(request.args.get('userinfo')) userdata['openid'] = resdata['openid'] # 设置注册时间 userdata['addtime'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") # 执行数据的添加 sql = ''' insert into users values( null,"{nikeName}","{avatarUrl}", "{username}","{bumen}","{phone}", "{openid}","{addtime}") '''.format(**userdata) # 执行添加,并获取最后的id userid = Model().exec(sql) # 返回json数据 return jsonify({'code': userid, 'msg': 'ok'})
def training(): if 'username' not in session: return redirect(url_for('login')) if chache[session['username']]['statustraining'] == 0 and session[ 'process_training']: session['process_training'].remove(1) session.modified = True modellabel = Model() emoticon = modellabel.select_label() modellabel.close_connection() return render_template('admin/pages/training.html', username=session['username'], training=session['process_training'], emoticon=emoticon)
def check_min_max_tweet(): if request.data: username = json.loads(request.data).get('username') keyword = json.loads(request.data).get('keyword') try: if session['username'] == username: modeltwitter = Model() dict_result = modeltwitter.select_min_max_tweet(keyword) modeltwitter.close_connection() return jsonify(dict_result) else: return redirect(url_for('login')) except Exception as error: print(error) return redirect(url_for('login')) else: return redirect(url_for('login'))
def table_preprocessing_keyword(): if request.data: username = json.loads(request.data).get('username') keyword = json.loads(request.data).get('keyword') try: if session['username'] == username: modeltwitter = Model() data_preprocessing = modeltwitter.select_keyword_not_preprocessing( keyword) modeltwitter.close_connection() # backgroundprocess_preprocessing(keyword, data_preprocessing, username) worker = threading.Thread( target=backgroundprocess_preprocessing, args=( keyword, data_preprocessing, username, )) worker.daemon = True worker.start() chache[session['username']]['statuspreprocessing'] = 1 data = {} data['statuspreprocessing'] = chache[ session['username']]['statuspreprocessing'] session['process_preprocessing'].append(1) session.modified = True return jsonify(data) else: return redirect(url_for('login')) except Exception as error: print(error) return redirect(url_for('login')) else: return redirect(url_for('login'))
def resolve(self, model): model.save(self.file_path) Model({ 'name': self.name, 'model_path': self.file_path, 'status': ModelStatus.ENABLE, 'user_id': self.user_id, 'module': model.__module__, 'method': model.__class__.__name__, 'project_id': self.project_id }).create() return model
def delete_stopword(): if request.data: username = json.loads(request.data).get('username') word = json.loads(request.data).get('word') try: if session['username'] == username: modelstopword = Model() result = modelstopword.delete_stopword(word) modelstopword.close_connection() return jsonify(result) else: return redirect(url_for('login')) except Exception as error: print(error) return redirect(url_for('login')) else: return redirect(url_for('login'))
def delete_label(): if request.data: username = json.loads(request.data).get('username') id_label = json.loads(request.data).get('id_label') try: if session['username'] == username: modellabel = Model() result = modellabel.delete_label(id_label) modellabel.close_connection() return jsonify(result) else: return redirect(url_for('login')) except Exception as error: print(error) return redirect(url_for('login')) else: return redirect(url_for('login'))
def classifier(): form = ClassifierForm() dataset = Dataset.query.all()[-1] if request.method == 'POST' and form.validate_on_submit(): logger.info(f'preprocessing: {form.preprocessing.data}, ' f'classifiers: {form.classifiers.data[0]} ' f'features: {form.features.data}') session['last_models'] = list() for clf_pk in form.classifiers.data: clf = Classifier.query.get(clf_pk) pre = Preprocessing.query.get(form.preprocessing.data) dt = datetime.now(timezone('America/Sao_Paulo')) model = Model(file=' ', datetime=dt, dataset_id=dataset.id, classifier_id=clf.id, preprocessing_id=form.preprocessing.data) for feat_pk in form.features.data: model.features.append(Feature.query.get(feat_pk)) db.session.add(model) db.session.commit() # committing the model to get the pk. model.file = (f'{model.id}_' f'{"-".join(clf.name.lower().split(" "))}_' f'{"-".join(pre.name.lower().split(" "))}_' f'{dt.strftime("%Y%m%d%H%M%S")}') db.session.add(model) db.session.commit() session['last_models'].append(model.id) logger.info(f'last_models: {session["last_models"]}') return redirect(url_for('setting.result')) return render_template('setting/classifier.html', form=form)
def login(): form = LoginForm(request.form) msg = None if 'username' in session: return redirect(url_for('index_admin')) if form.validate_on_submit(): username = request.form['username'] password = request.form['password'] modeluser = Model() account = modeluser.authethiaction_login(username, password) if account: dictperson = {} username_session = account['username'] session['username'] = username_session session['process_crawling'] = [] session['process_preprocessing'] = [] session['process_training'] = [] dictperson['statuscrawling'] = 0 dictperson['statuspreprocessing'] = 0 dictperson['statustraining'] = 0 chache[username_session] = dictperson return redirect(url_for('index_admin')) else: msg = "Wrong user or password. Please try again." elif 'username' not in session: return render_template('admin/pages/login.html', form=form, msg=msg) else: msg = 'Input error' return render_template('admin/pages/login.html', form=form, msg=msg)
def books_add(): # 判断当前的请求方式 if request.method == 'GET': # 显示添加的表单 return render_template('books/add.html') else: # 接受表单数据 data = request.form.to_dict() # print(data) # 判断是否上传了封面图 myfile = request.files.get('pic') # print(app.config['UP_DIR']) if myfile : # 执行文件的上传操作 Suffix = myfile.filename.split('.').pop() # 1.jpg filename = str(time.time())+str(random.randint(10000,99999))+'.'+Suffix myfile.save(app.config["UP_DIR"]+ filename) data['pic_url'] = filename else: # 判断是否右隐藏域传递了豆瓣的远程图片 imgurl = request.form.get('doubanimage',None) if not imgurl: return '<script>alert("请选择图书的封面图");history.back(-1);</script>' # 把远程的图片下载到本地服务器中 存储 Suffix = imgurl.split('.').pop() filename = str(time.time())+str(random.randint(10000,99999))+'.'+Suffix urllib.request.urlretrieve(imgurl,app.config["UP_DIR"]+filename) data['pic_url'] = filename data.pop('doubanimage') # return '' data['addtime'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") # 执行数据的添加 sql = ''' insert into books values( null,"{title}","{author}","{pic_url}" ,"{price}","{publisher}","{isbn13}","{summary}" ,"{catalog}","{pubdate}","{author_intro}" ,"{status}","{num}","{addtime}" ) '''.format(**data) res = Model().exec(sql) print(sql) print(res) if res : return '<script>alert("添加成功");location.href="'+url_for('admin.books_index')+'"</script>' return '<script>alert("添加失败");location.href="'+url_for('admin.books_add')+'"</script>'
def delete_kbba(): if request.data: username = json.loads(request.data).get('username') alay = json.loads(request.data).get('alay') baku = json.loads(request.data).get('baku') try: if session['username'] == username: modelkbba = Model() result = modelkbba.delete_kbba(alay, baku) modelkbba.close_connection() return jsonify(result) else: return redirect(url_for('login')) except Exception as error: print(error) return redirect(url_for('login')) else: return redirect(url_for('login'))
def visualitation_show(): if request.data: username = json.loads(request.data).get('username') keyword = json.loads(request.data).get('keyword') try: if session['username'] == username: modelcluster = Model() data = modelcluster.select_cluster_plot(keyword) modelcluster.close_connection() return jsonify(data) else: return redirect(url_for('login')) except Exception as error: print(error) return redirect(url_for('login')) else: return redirect(url_for('login'))
def find(query, sortingAttr="_id", sortOrder=1, pageNumber=1, type=QuestionType.SOC, numberOfPages=None): db = getDb() collectionName = getCollectionName(type) db[collectionName].create_index([("body", "text")]) return Model.find(collectionName, query, sortingAttr, sortOrder, pageNumber, numberOfPages=numberOfPages)
def vote_cmt(school): app.config['SQLALCHEMY_DATABASE_URI'] = app.config['SQLALCHEMY_DATABASE_URI_BASE'] + school cmt_id = request.args.get("cmt_id", 0) method = request.args.get("method", "error") # 获取用户ip,每个ip只能投一票 ip = request.remote_addr model = Model() if model.ip_exist(ip, cmt_id): return 'already voted' model.add_ip(ip, cmt_id, method) cmt = model.get_cmt_by_id(cmt_id) if not cmt: return 'comment not exist' model.change_vote(method, cmt) return "ok"
def create_model(): user = get_user(request) try: model = Model(name=request.get_json()['name'], user=user) for f in request.get_json()['fields']: field = Field(name=f['name'], model=model, data_type=f['data_type']) field.parent_node = f['parent_node'] if 'parent_node' in f else None model.fields.append(field) db.session.add(model) db.session.commit() query = Model.query.get(model.id) return jsonify(ModelSchema().dump(query).data), 201 except sqlalchemy.exc.SQLAlchemyError as e: db.session.rollback() return jsonify({"error": str(e)}), 401
def __init__(self, models_cfg): self._models = {} self._default_model_name = models_cfg[0]['model'] self._G = nx.DiGraph() for cfg in models_cfg: if not isinstance(cfg['source'], list) or not isinstance( cfg['target'], list): log.error("Error in config source and target must be lists") import sys sys.exit(1) model = Model.create(cfg) if model.model in self._models: log.error("Model names should be unique") import sys sys.exit(1) self._models[model.model] = model if cfg.get('default'): _default_model_name = cfg['model'] if cfg.get('include_in_graph', True): flip_src_tgt = cfg.get('target_to_source', False) for src_lang in cfg['source']: for tgt_lang in cfg['target']: # This will keep only the last model self._G.add_edge(src_lang, tgt_lang, cfg=model) if flip_src_tgt: self._G.add_edge(tgt_lang, src_lang, cfg=model) # There may be more than one shortest path between source and target; this returns only one self._shortest_path = nx.shortest_path(self._G) _directions = [] self._src_tgt = {} self._tgt_src = {} for item in self._shortest_path.items(): u = item[0] for v in item[1].keys(): if u != v: display = '{}->{}'.format(to_name(u), to_name(v)) _directions.append((u, v, display)) targets = get_or_create(self._src_tgt, u) targets.append(v) sources = get_or_create(self._tgt_src, v) sources.append(u) self._directions = sorted(_directions, key=lambda x: x[2])
def add_random_models( user_id: int = None, project_id: int = None, count: int = 25 ) -> None: users = User.query.all() projects = Project.query.all() for i in range(count): name = get_random_name(separator=" ") number = randint(10, 50) # if given, assign the user selected_user_id = choice(users).id if user_id != None: selected_user_id = user_id selected_project_id = choice(projects).id # if given, assign the project if project_id != None: selected_project_id = project_id print( f"#{i+1} Adding model `{name}` to project_id {selected_project_id} with user_id {selected_user_id}" ) hyperparameters = get_random_dictionary(10, 20) parameters = get_random_dictionary(10, 100) metrics = get_random_dictionary(5, 15) new_model = Model( user_id=selected_user_id, project_id=selected_project_id, hyperparameters=hyperparameters, parameters=parameters, metrics=metrics, name=f"Randomized: {name}", path=uuid.uuid4(), dataset_name=f"Random dataset #{number}", dataset_description=DESCRIPTION, git_active_branch="develop", git_commit_hash="29ea5f511668248ea7ffe229c0f09992aaa6b382", private=False, ) db.session.add(new_model) db.session.commit()
def books_borrow(): # 接受数据 data = request.args.to_dict() # 先检测当前图书的数量 selsql = 'select num from books where isbn13 = ' + data['book_isbn'] selres = Model().query(selsql) if selres[0]['num'] <= 0: return jsonify({'msg': '当前图书已经被借阅,只能预约', 'error': 1}) data['addtime'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") data['status'] = 0 # 执行数据的创建 print('执行数据的创建') sql = 'insert into borrow values(null,"{book_isbn}",{user_id},"{addtime}",{status})'.format( **data) # # 修改图书的可借阅的数量 upsql = 'update books set num = num-1 where isbn13 = ' + data['book_isbn'] import pymysql # 打开数据库连接 db = pymysql.connect("localhost", "root", "", "wxapp") # 使用cursor()方法获取操作游标 cursor = db.cursor() # SQL 插入语句 try: # 执行sql语句 cursor.execute(sql) cursor.execute(upsql) # 提交到数据库执行 db.commit() resdata = {'msg': 'ok', 'error': 0} except: # 如果发生错误则回滚 db.rollback() resdata = {'msg': '执行错误', 'error': 2} # 关闭数据库连接 db.close() return jsonify(resdata)
def delete_user(key): user = User.query.get(key) Model.delete(user) return 'success'
def get_random_teacher(school): app.config['SQLALCHEMY_DATABASE_URI'] = app.config['SQLALCHEMY_DATABASE_URI_BASE'] + school wechat = app.config['WECHAT_REL'][school] return render_template('index.html', teachers=Model.get_random_teacher(), wechat=wechat)
def pop(school): app.config['SQLALCHEMY_DATABASE_URI'] = app.config['SQLALCHEMY_DATABASE_URI_BASE'] + school teachers = Model.get_pop_teachers(20) return render_template("pop.html", teachers=teachers)
def low(school): app.config['SQLALCHEMY_DATABASE_URI'] = app.config['SQLALCHEMY_DATABASE_URI_BASE'] + school teachers = Model.get_low_score_teachers(20) return render_template("low.html", teachers=teachers)