|
|
@ -1,14 +1,11 @@
|
|
|
|
from flask import Flask, render_template, request, redirect, url_for, jsonify
|
|
|
|
from flask import Flask, render_template, request, redirect, url_for, jsonify
|
|
|
|
from werkzeug.utils import secure_filename
|
|
|
|
from werkzeug.utils import secure_filename
|
|
|
|
|
|
|
|
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import sqlite3
|
|
|
|
import sqlite3
|
|
|
|
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
Path(f'static/panels/').mkdir(exist_ok=True)
|
|
|
|
|
|
|
|
Path(f'static/cables/').mkdir(exist_ok=True)
|
|
|
|
|
|
|
|
Path(f'static/snippets/').mkdir(exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PrefixMiddleware(object):
|
|
|
|
class PrefixMiddleware(object):
|
|
|
|
def __init__(self, app, prefix=""):
|
|
|
|
def __init__(self, app, prefix=""):
|
|
|
@ -26,11 +23,16 @@ class PrefixMiddleware(object):
|
|
|
|
return ["This url does not belong to the app.".encode()]
|
|
|
|
return ["This url does not belong to the app.".encode()]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
load_dotenv()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Path(f'static/panels/').mkdir(exist_ok=True)
|
|
|
|
|
|
|
|
Path(f'static/cables/').mkdir(exist_ok=True)
|
|
|
|
|
|
|
|
Path(f'static/snippets/').mkdir(exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
# register the middleware to prefix all the requests with our base_url
|
|
|
|
# register the middleware to prefix all the requests with our base_url
|
|
|
|
app.wsgi_app = PrefixMiddleware(app.wsgi_app, prefix='/soupboat/workbook')
|
|
|
|
app.wsgi_app = PrefixMiddleware(app.wsgi_app, prefix=os.environ.get('BASE_URL', ''))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_db_connection():
|
|
|
|
def get_db_connection():
|
|
|
|