@@ -0,0 +1 @@
+from . import view
@@ -0,0 +1,10 @@
+import flask.blueprints
+import flask
+
+home = flask.blueprints.Blueprint("home", __name__)
+@home.route("/")
+def index():
+ return flask.render_template("index.html")
@@ -0,0 +1,20 @@
+from flask import Flask
+import configure
+from . import home
+class HEnglishFlask(Flask):
+ def __init__(self, import_name, **kwargs):
+ super().__init__(import_name, **kwargs)
+ self.update_config()
+ @self.context_processor
+ def inject_base():
+ return {"title": self.config["TITLE"],
+ "about": self.config["ABOUT"]}
+ self.register_blueprint(home.home, url_prefix="/")
+ def update_config(self):
+ self.config.update(configure.conf)
+ self.logger.info("Update config")
@@ -0,0 +1,14 @@
+import json
+conf = {
+ "SECRET_KET": "HEnglish",
+ "TITLE": "HEnglish :D",
+ "ABOUT": "An useful English learning website for personal."
+}
+def configure(file_path: str, encoding: str = "utf-8"):
+ with open(file_path, mode="r", encoding=encoding) as f:
+ json_str = f.read()
+ _conf: dict = json.loads(json_str)
+ conf.update(_conf)
@@ -1,6 +1,5 @@
import sqlite3
from typing import Optional, Union, List, Tuple, Dict
-import traceback
import logging
import pandas
import word
+from . import db
@@ -0,0 +1,5 @@
+import app as App
+app = App.view.HEnglishFlask(__name__)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title> {{ title }} </title>
+</head>
+<body>
+<h1> Welcome to {{ title }} ! </h1>
+<p> {{ about }} </p>
+</body>
+</html>