Working single file upload
This commit is contained in:
1 parent
d406574707
commit
d332aca22e
7 files changed
+75
-21
No files matched your search
Whitespace-only changes.
+4
-13
@@ -1,21 +1,12 @@
|
||||
from flask import g
|
||||
from database.sqlite import SQLite
|
||||
from flask import g, current_app
|
||||
from .database.sqlite import SQLite
|
||||
import json
|
||||
|
||||
def get_config():
|
||||
config = getattr(g, "_config", None)
|
||||
|
||||
if config is None:
|
||||
with open("../config.json") as config_file:
|
||||
config = g._config = json.loads(config_file.read())
|
||||
|
||||
return config
|
||||
|
||||
def get_db():
|
||||
db = getattr(g, "_database", None)
|
||||
|
||||
if db is None:
|
||||
if str(get_config()["database"]["type"]).casefold() == "SQLite".casefold():
|
||||
db = g._database = SQLite(get_config()["database"]["name"])
|
||||
if str(current_app.config["config"]["database"]["type"]).casefold() == "SQLite".casefold():
|
||||
db = g._database = SQLite(current_app.config["config"]["database"]["name"])
|
||||
|
||||
return db
|
||||
Reference in new issue
Block a user