From 621ac24991a68ffece9d49044034794b241a241a Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Sat, 31 Aug 2024 07:38:30 +0800 Subject: [PATCH] Give the blueprint a better name: apiService --- app/api_service.py | 4 ++-- app/main.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api_service.py b/app/api_service.py index 034a46d..fd88681 100644 --- a/app/api_service.py +++ b/app/api_service.py @@ -5,7 +5,7 @@ from Article import load_freq_history path_prefix = '/var/www/wordfreq/wordfreq/' path_prefix = './' # comment this line in deployment -show_bp = Blueprint('site',__name__) +apiService = Blueprint('site',__name__) auth = HTTPTokenAuth(scheme='Bearer') @@ -21,7 +21,7 @@ def verify_token(token): return tokens[token] -@show_bp.route('/api/mywords') # HTTPie usage: http -A bearer -a secret-token http://127.0.0.1:5000/api/mywords +@apiService.route('/api/mywords') # HTTPie usage: http -A bearer -a secret-token http://127.0.0.1:5000/api/mywords @auth.login_required def show(): username = auth.current_user() diff --git a/app/main.py b/app/main.py index eeb4960..4af4456 100644 --- a/app/main.py +++ b/app/main.py @@ -10,7 +10,7 @@ import Yaml from user_service import userService from account_service import accountService from admin_service import adminService, ADMIN_NAME -from api_service import show_bp +from api_service import apiService import os from translate import * @@ -22,7 +22,7 @@ app.secret_key = os.urandom(32) app.register_blueprint(userService) app.register_blueprint(accountService) app.register_blueprint(adminService) -app.register_blueprint(show_bp) +app.register_blueprint(apiService) path_prefix = '/var/www/wordfreq/wordfreq/' path_prefix = './' # comment this line in deployment