Spaces:
Sleeping
Sleeping
fix
Browse files
app.py
CHANGED
|
@@ -22,6 +22,10 @@ def create_app():
|
|
| 22 |
app = Flask(__name__)
|
| 23 |
CORS(app, resources={r"/*": {"origins": "*"}})
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
# --------------------------
|
| 26 |
# Request logging
|
| 27 |
# --------------------------
|
|
@@ -53,26 +57,39 @@ def create_app():
|
|
| 53 |
# Blueprint registration
|
| 54 |
# --------------------------
|
| 55 |
try:
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
#
|
| 63 |
-
app.register_blueprint(
|
| 64 |
-
|
| 65 |
-
app.register_blueprint(expectations_bp) # routes already start with /api/...
|
| 66 |
-
app.register_blueprint(matching_bp, url_prefix="/api") # => /api/match, /api/match/<user_id>
|
| 67 |
-
app.register_blueprint(llm_bp) # /llm/start, /llm/next
|
| 68 |
|
| 69 |
-
print("β
DEBUG: All blueprints registered
|
| 70 |
|
| 71 |
except Exception as e:
|
| 72 |
print("β DEBUG: Failed to import/register blueprints:", e)
|
| 73 |
import traceback
|
| 74 |
traceback.print_exc()
|
| 75 |
-
#
|
|
|
|
| 76 |
|
| 77 |
# --------------------------
|
| 78 |
# Debug route to list all registered routes
|
|
|
|
| 22 |
app = Flask(__name__)
|
| 23 |
CORS(app, resources={r"/*": {"origins": "*"}})
|
| 24 |
|
| 25 |
+
print("π DEBUG: Starting app creation...")
|
| 26 |
+
print(f"π DEBUG: SQL_SERVER = {SQL_SERVER}")
|
| 27 |
+
print(f"π DEBUG: SQL_DB = {SQL_DB}")
|
| 28 |
+
|
| 29 |
# --------------------------
|
| 30 |
# Request logging
|
| 31 |
# --------------------------
|
|
|
|
| 57 |
# Blueprint registration
|
| 58 |
# --------------------------
|
| 59 |
try:
|
| 60 |
+
# Use the routes package that already exposes all blueprints
|
| 61 |
+
import routes
|
| 62 |
+
|
| 63 |
+
print("β
DEBUG: Imported routes package")
|
| 64 |
+
|
| 65 |
+
# Auth under /api -> /api/signup, /api/login, ...
|
| 66 |
+
app.register_blueprint(routes.auth_bp, url_prefix="/api")
|
| 67 |
+
print("β
DEBUG: Registered auth_bp with prefix /api")
|
| 68 |
+
|
| 69 |
+
# Profile routes already have /api/... in their route paths
|
| 70 |
+
app.register_blueprint(routes.profiles_bp)
|
| 71 |
+
print("β
DEBUG: Registered profiles_bp (no prefix)")
|
| 72 |
+
|
| 73 |
+
# Expectation routes already have /api/... in their route paths
|
| 74 |
+
app.register_blueprint(routes.expectations_bp)
|
| 75 |
+
print("β
DEBUG: Registered expectations_bp (no prefix)")
|
| 76 |
+
|
| 77 |
+
# Matching under /api -> /api/match and /api/match/<user_id>
|
| 78 |
+
app.register_blueprint(routes.matching_bp, url_prefix="/api")
|
| 79 |
+
print("β
DEBUG: Registered matching_bp with prefix /api")
|
| 80 |
|
| 81 |
+
# LLM routes (e.g. /llm/start, /llm/next)
|
| 82 |
+
app.register_blueprint(routes.llm_bp)
|
| 83 |
+
print("β
DEBUG: Registered llm_bp (no prefix)")
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
+
print("β
DEBUG: All blueprints registered successfully")
|
| 86 |
|
| 87 |
except Exception as e:
|
| 88 |
print("β DEBUG: Failed to import/register blueprints:", e)
|
| 89 |
import traceback
|
| 90 |
traceback.print_exc()
|
| 91 |
+
# Important: re-raise so the app does NOT start silently without routes
|
| 92 |
+
raise
|
| 93 |
|
| 94 |
# --------------------------
|
| 95 |
# Debug route to list all registered routes
|