diff --git a/app/main.py b/app/main.py index e311bb0..409ddf1 100644 --- a/app/main.py +++ b/app/main.py @@ -12,12 +12,14 @@ from Article import * import Yaml from user_service import userService from account_service import accountService +from wordCMD import show_bp app = Flask(__name__) app.secret_key = 'lunch.time!' # 将蓝图注册到Lab app app.register_blueprint(userService) app.register_blueprint(accountService) +app.register_blueprint(show_bp) path_prefix = '/var/www/wordfreq/wordfreq/' path_prefix = './' # comment this line in deployment diff --git a/app/static/words.sql b/app/static/words.sql new file mode 100644 index 0000000..7b0b44c --- /dev/null +++ b/app/static/words.sql @@ -0,0 +1,18 @@ +PRAGMA foreign_keys = OFF; + + +DROP TABLE IF EXISTS "main"."words"; +CREATE TABLE "words" ( +"user" TEXT NOT NULL, +"word" TEXT NOT NULL +); + + +INSERT INTO "main"."words" VALUES ('jack', 'numb'); +INSERT INTO "main"."words" VALUES ('jack', 'faint'); +INSERT INTO "main"."words" VALUES ('alice', 'tube'); +INSERT INTO "main"."words" VALUES ('alice', 'cake'); +INSERT INTO "main"."words" VALUES ('tom', 'kite'); +INSERT INTO "main"."words" VALUES ('tom', 'fly'); +INSERT INTO "main"."words" VALUES ('jack', 'be'); +INSERT INTO "main"."words" VALUES ('jack', 'fly'); diff --git a/app/wordCMD.py b/app/wordCMD.py new file mode 100644 index 0000000..94546ce --- /dev/null +++ b/app/wordCMD.py @@ -0,0 +1,41 @@ +from flask import Flask, request, Blueprint, render_template +from UseSqlite import InsertQuery, RecordQuery + +TKTK = 'token' # set token + +show_bp = Blueprint( + 'site', + __name__, +) + + +def make_html_paragraph(s): # build the word's table + if s.strip() == '': + return '' + lst = s.split(',') + word = lst[1].strip() + result = '
WORDS | ' + record += '
---|