diff options
author | Frederick Muriuki Muriithi | 2022-04-20 13:44:26 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-04-20 13:44:26 +0300 |
commit | 7b3dc9d36de1db28a6f36b03de85cf7f527231cc (patch) | |
tree | 38e33e6eb9e5ec2bbc99ca512ee3e01e996a91c6 /qc_app | |
parent | 7cd50dbc6dc5c14bb211699e7a7103e4f1453edd (diff) | |
download | gn-uploader-7b3dc9d36de1db28a6f36b03de85cf7f527231cc.tar.gz |
Add scaffolding for web app
Add a basic scaffolding for the web interface to the quality-control
application.
Diffstat (limited to 'qc_app')
-rw-r--r-- | qc_app/__init__.py | 21 | ||||
-rw-r--r-- | qc_app/entry.py | 9 | ||||
-rw-r--r-- | qc_app/parse_error.py | 9 | ||||
-rw-r--r-- | qc_app/parse_success.py | 9 |
4 files changed, 48 insertions, 0 deletions
diff --git a/qc_app/__init__.py b/qc_app/__init__.py new file mode 100644 index 0000000..2dd5758 --- /dev/null +++ b/qc_app/__init__.py @@ -0,0 +1,21 @@ +"""The Quality-Control Web Application entry point""" + +import os +from flask import Flask + +from .entry import entrybp +from .parse_error import parseerrbp +from .parse_success import parsesuccessbp + +def create_app(instance_path): + """The application factory""" + app = Flask( + __name__, instance_path=instance_path, instance_relative_config=True) + app.config.from_pyfile(os.path.join(os.getcwd(), "etc/default_config.py")) + app.config.from_pyfile("config.py") # Override defaults with instance path + + # setup blueprints + app.register_blueprint(entrybp, url_prefix="/") + app.register_blueprint(parseerrbp, url_prefix="/error") + app.register_blueprint(parsesuccessbp, url_prefix="/success") + return app diff --git a/qc_app/entry.py b/qc_app/entry.py new file mode 100644 index 0000000..4963246 --- /dev/null +++ b/qc_app/entry.py @@ -0,0 +1,9 @@ +"""Entry-point module""" +from flask import Blueprint + +entrybp = Blueprint("entry", __name__) + +@entrybp.route("/", methods=["GET", "POST"]) +def upload_file(): + """Enables uploading the files""" + return "STUB: We upload the files here" diff --git a/qc_app/parse_error.py b/qc_app/parse_error.py new file mode 100644 index 0000000..1414b78 --- /dev/null +++ b/qc_app/parse_error.py @@ -0,0 +1,9 @@ +"""Parse Error handling blue print""" +from flask import Blueprint + +parseerrbp = Blueprint("parse_error", __name__) + +@parseerrbp.route("/", methods=["GET"]) +def parse_success(): + """Indicates success if parsing the file is fails""" + return "STUB: Parse error!!!" diff --git a/qc_app/parse_success.py b/qc_app/parse_success.py new file mode 100644 index 0000000..53b9c42 --- /dev/null +++ b/qc_app/parse_success.py @@ -0,0 +1,9 @@ +"""Successful file parsing module""" +from flask import Blueprint + +parsesuccessbp = Blueprint("parse_success", __name__) + +@parsesuccessbp.route("/", methods=["GET"]) +def parse_success(): + """Indicates success if parsing the file is successful""" + return "STUB: Parse success!!!" |