diff --git a/NewColorStyle.png b/NewColorStyle.png new file mode 100644 index 0000000..0f69a3a Binary files /dev/null and b/NewColorStyle.png differ diff --git a/Result.png b/Result.png new file mode 100644 index 0000000..81edf7a Binary files /dev/null and b/Result.png differ diff --git a/database.sqlite b/database.sqlite index 114ba9e..9dbe3ce 100644 Binary files a/database.sqlite and b/database.sqlite differ diff --git a/service.py b/service.py index af5395e..5274eda 100644 --- a/service.py +++ b/service.py @@ -1,3 +1,5 @@ + + from flask_sqlalchemy import SQLAlchemy from sqlalchemy import or_ import os, uuid ,math, random @@ -5,6 +7,8 @@ from werkzeug.utils import secure_filename from datetime import datetime, timedelta from flask import Flask + + basedir = os.path.abspath(os.path.dirname(__file__)) UPLOAD_FOLDER = basedir + '\static\pdf' ALLOWED_EXTENSIONS = set(['pdf']) @@ -317,7 +321,7 @@ def get_subject(subjectID): hot_article.append(x) return render_template('subject.html', url=url, subject_id=subject.id, articles=articles, hot_article=hot_article, Tool=Tool) - + # ============================================================================================ # before request # ============================================================================================ @@ -357,7 +361,10 @@ def before_request(): # ============================================================================================# @app.route('/') def index(): - return render_template('io.html') + subjects = Subject.query.order_by(Subject.id.asc()) + articles = Article.query.order_by(Article.metric.desc())[0:5] + totalart = Article.query.order_by(Article.time.desc()) + return render_template('io.html', articles=articles, subjects=subjects, totalart=totalart, Tool=Tool) @app.route('/test') def test_one(): @@ -381,7 +388,7 @@ def find_subjects(subject, count): find_subjects(subject, count + 1) subjects = Subject.query.filter_by(pid='None').all() - out.write('{% extends "template.html" %}' + '\n') + out.write( '{% extends "template.html" %}' + '\n') out.write('{% block content %}' + '\n') for subject in subjects: find_subjects(subject, 0) diff --git a/templates/io.html b/templates/io.html index 6af74c5..d6ab597 100644 --- a/templates/io.html +++ b/templates/io.html @@ -1,76 +1,29 @@ {% extends "template.html" %} {% block content %} -
+ + + +