coding documentation

master
km0 2 years ago
parent e8ab523cf8
commit ecd42c85ad

@ -20,8 +20,6 @@ load_dotenv(dotenv_path=dotenv_path)
load_dotenv()
# prefix to add /soupboat/padliography to all the routes
# and to leave the @app.route() decorator more clean
class PrefixMiddleware(object):
def __init__(self, app, prefix=""):
self.app = app
@ -42,7 +40,7 @@ class PrefixMiddleware(object):
app = Flask(__name__)
# Get the URL prefix for the soupboat
# and register the middleware to use our base_url as prefix on all the requests
# register the middleware to use our base_url as prefix on all the requests
base_url = os.environ.get('BASE_URL', '')
app.wsgi_app = PrefixMiddleware(app.wsgi_app, prefix=base_url)
@ -109,6 +107,7 @@ def get_pads():
return pads
# Routes
@app.route('/')
def home():
@ -140,5 +139,8 @@ def api():
return response
# Get the port and mount the app
port = os.environ.get('FLASK_RUN_PORT', '')
app.run(port=port)

Loading…
Cancel
Save