Update main.py
Browse files
main.py
CHANGED
|
@@ -329,12 +329,16 @@ def approve_user_phone():
|
|
| 329 |
# -----------------------------------------------------------------------------
|
| 330 |
|
| 331 |
if __name__ == '__main__':
|
| 332 |
-
port = int(os.environ.get("PORT",
|
| 333 |
debug_mode = os.environ.get("FLASK_DEBUG", "False").lower() == "true"
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
from waitress import serve
|
| 338 |
-
serve(app, host="0.0.0.0", port=port)
|
| 339 |
else:
|
| 340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
# -----------------------------------------------------------------------------
|
| 330 |
|
| 331 |
if __name__ == '__main__':
|
| 332 |
+
port = int(os.environ.get("PORT", 7860))
|
| 333 |
debug_mode = os.environ.get("FLASK_DEBUG", "False").lower() == "true"
|
| 334 |
+
logger.info(f"Starting Flask app. Debug mode: {debug_mode}, Port: {port}")
|
| 335 |
+
if not db:
|
| 336 |
+
logger.critical("Firestore client failed to initialize. Application cannot run.")
|
|
|
|
|
|
|
| 337 |
else:
|
| 338 |
+
if not debug_mode:
|
| 339 |
+
from waitress import serve
|
| 340 |
+
logger.info("Running in production mode using Waitress.")
|
| 341 |
+
serve(app, host="0.0.0.0", port=port)
|
| 342 |
+
else:
|
| 343 |
+
logger.info("Running in debug mode using Flask development server.")
|
| 344 |
+
app.run(debug=True, host="0.0.0.0", port=port)
|