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