Update app.py
Browse files
app.py
CHANGED
|
@@ -84,9 +84,25 @@ app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB max
|
|
| 84 |
# # --- CONFIGURE SERVER-SIDE SESSIONS ---
|
| 85 |
app.config["SESSION_PERMANENT"] = False
|
| 86 |
app.config["SESSION_TYPE"] = "filesystem"
|
| 87 |
-
app.config["SESSION_FILE_DIR"] = "/
|
| 88 |
Session(app)
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
google_api_key = os.getenv("GOOGLE_API_KEY")
|
| 91 |
if not google_api_key:
|
| 92 |
logger.warning("⚠️ GOOGLE_API_KEY not found in environment variables. LLM calls will fail.")
|
|
|
|
| 84 |
# # --- CONFIGURE SERVER-SIDE SESSIONS ---
|
| 85 |
app.config["SESSION_PERMANENT"] = False
|
| 86 |
app.config["SESSION_TYPE"] = "filesystem"
|
| 87 |
+
app.config["SESSION_FILE_DIR"] = "/tmp/flask_session" # <-- 1. CHANGED PATH
|
| 88 |
Session(app)
|
| 89 |
|
| 90 |
+
# --- START OF NEW DEBUG BLOCK ---
|
| 91 |
+
SESSION_DIR = app.config["SESSION_FILE_DIR"]
|
| 92 |
+
logger.info(f"--- SESSION DEBUG ---")
|
| 93 |
+
logger.info(f"SESSION_DIR set to: {SESSION_DIR}")
|
| 94 |
+
try:
|
| 95 |
+
# Attempt to create the dir from within Python, just in case
|
| 96 |
+
os.makedirs(SESSION_DIR, exist_ok=True)
|
| 97 |
+
|
| 98 |
+
if os.access(SESSION_DIR, os.W_OK):
|
| 99 |
+
logger.info(f"✅ SUCCESS: Session directory {SESSION_DIR} is WRITABLE.")
|
| 100 |
+
else:
|
| 101 |
+
logger.error(f"❌ FAILED: Session directory {SESSION_DIR} is NOT WRITABLE.")
|
| 102 |
+
except Exception as e:
|
| 103 |
+
logger.error(f"❌ FAILED: Error checking/creating session directory {SESSION_DIR}: {e}")
|
| 104 |
+
logger.info(f"--- END SESSION DEBUG ---")
|
| 105 |
+
|
| 106 |
google_api_key = os.getenv("GOOGLE_API_KEY")
|
| 107 |
if not google_api_key:
|
| 108 |
logger.warning("⚠️ GOOGLE_API_KEY not found in environment variables. LLM calls will fail.")
|