mirror of
https://github.com/Av0idD4rk/firegex.git
synced 2026-10-23 21:42:05 +00:00
Fix debug mode in production
This commit is contained in:
parent
425a6c356a
commit
07552e36da
@ -12,9 +12,15 @@ db.connect()
|
|||||||
conf = KeyValueStorage(db)
|
conf = KeyValueStorage(db)
|
||||||
firewall = ProxyManager(db)
|
firewall = ProxyManager(db)
|
||||||
|
|
||||||
|
try:
|
||||||
|
import uwsgi
|
||||||
|
IN_UWSGI = True
|
||||||
|
except ImportError:
|
||||||
|
IN_UWSGI = False
|
||||||
|
|
||||||
app = Flask(__name__)
|
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():
|
def is_loggined():
|
||||||
if DEBUG: return True
|
if DEBUG: return True
|
||||||
@ -44,6 +50,13 @@ def before_first_request():
|
|||||||
|
|
||||||
@app.route("/api/status")
|
@app.route("/api/status")
|
||||||
def get_status():
|
def get_status():
|
||||||
|
if DEBUG:
|
||||||
|
return {
|
||||||
|
"status":app.config["STATUS"],
|
||||||
|
"loggined": is_loggined(),
|
||||||
|
"debug":True
|
||||||
|
}
|
||||||
|
else:
|
||||||
return {
|
return {
|
||||||
"status":app.config["STATUS"],
|
"status":app.config["STATUS"],
|
||||||
"loggined": is_loggined()
|
"loggined": is_loggined()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user