|
@@ -4,45 +4,30 @@ from .rank_web import RankWebsite
|
|
from sql.db import DB
|
|
from sql.db import DB
|
|
from tool.type_ import Optional
|
|
from tool.type_ import Optional
|
|
|
|
|
|
-main = Blueprint("main", __name__)
|
|
|
|
|
|
+rank_web = Blueprint("rank_web", __name__)
|
|
rank_website: Optional[RankWebsite] = None
|
|
rank_website: Optional[RankWebsite] = None
|
|
rank_app: Optional[Flask] = None
|
|
rank_app: Optional[Flask] = None
|
|
|
|
|
|
|
|
|
|
-@main.route('/')
|
|
|
|
-def index():
|
|
|
|
- return render_template("index.html", loc=Config.base_location)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-@main.route('/start')
|
|
|
|
-def start():
|
|
|
|
- return render_template("start.html", loc=Config.base_location)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-@main.route('/rank_up')
|
|
|
|
|
|
+@rank_web.route('/up')
|
|
def rank_up():
|
|
def rank_up():
|
|
global rank_website
|
|
global rank_website
|
|
data = rank_website.get_rank("DESC")
|
|
data = rank_website.get_rank("DESC")
|
|
- return render_template("ranking.html", rank_info=data, ranking_name="高分榜")
|
|
|
|
|
|
+ return render_template("rank_web/ranking.html", rank_info=data, ranking_name="高分榜")
|
|
|
|
|
|
|
|
|
|
-@main.route('/rank_down')
|
|
|
|
|
|
+@rank_web.route('/down')
|
|
def rank_down():
|
|
def rank_down():
|
|
global rank_website
|
|
global rank_website
|
|
data = rank_website.get_rank("ASC")
|
|
data = rank_website.get_rank("ASC")
|
|
- return render_template("ranking.html", rank_info=data, ranking_name="警示榜")
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-@main.app_errorhandler(404)
|
|
|
|
-def error_404(e):
|
|
|
|
- return render_template("error.html", error_code="404", error_info=e), 404
|
|
|
|
|
|
+ return render_template("rank_web/ranking.html", rank_info=data, ranking_name="警示榜")
|
|
|
|
|
|
|
|
|
|
-def creat_ranking_website(db: DB):
|
|
|
|
|
|
+def creat_ranking_website(app: Flask, db: DB):
|
|
global rank_website, rank_app
|
|
global rank_website, rank_app
|
|
if rank_website is not None:
|
|
if rank_website is not None:
|
|
- return rank_website, rank_website.app
|
|
|
|
- rank_app = Flask(__name__)
|
|
|
|
- rank_app.register_blueprint(main)
|
|
|
|
|
|
+ return rank_website
|
|
|
|
+ rank_app = app
|
|
|
|
+ rank_app.register_blueprint(rank_web, url_prefix="/rank")
|
|
rank_website = RankWebsite(db, rank_app)
|
|
rank_website = RankWebsite(db, rank_app)
|
|
- return rank_website, rank_app
|
|
|
|
|
|
+ return rank_website
|