diff --git a/app/config.py b/app/config.py index ae2082ee..11608748 100644 --- a/app/config.py +++ b/app/config.py @@ -30,6 +30,8 @@ COLOR_LOG = "COLOR_LOG" in os.environ # Allow user to have 1 year of premium: set the expiration_date to 1 year more PROMO_CODE = "SIMPLEISBETTER" +# Debug mode +DEBUG = os.environ['DEBUG'] # Server url URL = os.environ["URL"] print(">>> URL:", URL) diff --git a/server.py b/server.py index 08d95c42..5425b926 100644 --- a/server.py +++ b/server.py @@ -18,6 +18,7 @@ from app.admin_model import SLModelView, SLAdminIndexView from app.api.base import api_bp from app.auth.base import auth_bp from app.config import ( + DEBUG, DB_URI, FLASK_SECRET, SENTRY_DSN, @@ -67,6 +68,8 @@ os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" def create_app() -> Flask: app = Flask(__name__) app.url_map.strict_slashes = False + app.debug = DEBUG + os.environ["FLASK_DEBUG"] = DEBUG app.config["SQLALCHEMY_DATABASE_URI"] = DB_URI app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False @@ -422,8 +425,6 @@ window.location.href = "/"; if __name__ == "__main__": app = create_app() - app.debug = True - # enable flask toolbar # app.config["DEBUG_TB_PROFILER_ENABLED"] = True # app.config["DEBUG_TB_INTERCEPT_REDIRECTS"] = False @@ -444,6 +445,6 @@ if __name__ == "__main__": context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) context.load_cert_chain("local_data/cert.pem", "local_data/key.pem") - app.run(debug=True, host="0.0.0.0", port=7777, ssl_context=context) + app.run(host="0.0.0.0", port=7777, ssl_context=context) else: - app.run(debug=True, host="0.0.0.0", port=7777) + app.run(host="0.0.0.0", port=7777)