fix: App organization improvement
This commit is contained in:
parent
abc380aa81
commit
4a525457a6
6
debug.sh
6
debug.sh
|
@ -1,3 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
venv/bin/python -m flask run --debug -h 192.168.5.3
|
venv/bin/python -m flask \
|
||||||
|
--app src \
|
||||||
|
run \
|
||||||
|
--debug \
|
||||||
|
-h 192.168.5.3
|
||||||
|
|
|
@ -8,20 +8,18 @@ from pygments import formatters, highlight, lexers
|
||||||
import markdown
|
import markdown
|
||||||
|
|
||||||
from src import (
|
from src import (
|
||||||
# tango_controller,
|
|
||||||
utils,
|
utils,
|
||||||
config,
|
config,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# TODO: Put the creation of the Flask application into a function
|
||||||
|
# https://flask.palletsprojects.com/en/3.0.x/tutorial/factory/
|
||||||
|
# def create_app() -> flask.Flask:
|
||||||
app = Flask(
|
app = Flask(
|
||||||
__name__,
|
__name__,
|
||||||
template_folder="../templates",
|
template_folder="../templates",
|
||||||
static_folder="../static",
|
static_folder="../static",
|
||||||
)
|
)
|
||||||
# app.register_blueprint(tango_controller.bp)
|
|
||||||
|
|
||||||
# Edit
|
|
||||||
# Create file
|
|
||||||
|
|
||||||
|
|
||||||
def get_tree() -> dict:
|
def get_tree() -> dict:
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
# ERRORS ######################################################################
|
||||||
|
|
||||||
|
def err(message: str, code: int):
|
||||||
|
return {"error": message}, code
|
||||||
|
|
||||||
|
|
||||||
|
ERR_500 = err("Internal server error", 500)
|
||||||
|
ERR_403 = err("Not authorized", 403)
|
||||||
|
ERR_404 = err("Not found", 404)
|
Loading…
Reference in New Issue