Fix debug mode in production

This commit is contained in:
DomySh
2022-06-17 20:09:54 +02:00
parent 425a6c356a
commit 07552e36da

View File

@@ -12,9 +12,15 @@ db.connect()
conf = KeyValueStorage(db)
firewall = ProxyManager(db)
try:
import uwsgi
IN_UWSGI = True
except ImportError:
IN_UWSGI = False
app = Flask(__name__)
DEBUG = not (len(sys.argv) > 1 and sys.argv[1] == "UWSGI")
DEBUG = not ((len(sys.argv) > 1 and sys.argv[1] == "UWSGI") or IN_UWSGI)
def is_loggined():
if DEBUG: return True
@@ -44,10 +50,17 @@ def before_first_request():
@app.route("/api/status")
def get_status():
return {
"status":app.config["STATUS"],
"loggined": is_loggined()
}
if DEBUG:
return {
"status":app.config["STATUS"],
"loggined": is_loggined(),
"debug":True
}
else:
return {
"status":app.config["STATUS"],
"loggined": is_loggined()
}
@app.route("/api/login", methods = ['POST'])
def login():