Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,8 +47,10 @@ from services.evaluation import evaluate_answer # Imported, models loaded here
|
|
| 47 |
|
| 48 |
@app.route("/")
|
| 49 |
def home():
|
| 50 |
-
# This line
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
return render_template("home.html", tests=tests)
|
| 53 |
|
| 54 |
if __name__ == "__main__":
|
|
|
|
| 47 |
|
| 48 |
@app.route("/")
|
| 49 |
def home():
|
| 50 |
+
# This line uses the explicit client connection (mongo.cx) and database name (DB_NAME)
|
| 51 |
+
# to avoid the 'AttributeError: NoneType' object has no attribute 'tests' crash.
|
| 52 |
+
global DB_NAME
|
| 53 |
+
tests = list(mongo.cx[DB_NAME].tests.find({}, {"_id": 0}))
|
| 54 |
return render_template("home.html", tests=tests)
|
| 55 |
|
| 56 |
if __name__ == "__main__":
|