roshcheeku commited on
Commit
9878f46
·
verified ·
1 Parent(s): 216fced

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -15,28 +15,30 @@ from routes.courses import courses_bp
15
  from routes.feedback import feedback_bp
16
  from routes.profile import profile_bp
17
  from routes.admin import admin_bp
18
-
19
  app.register_blueprint(auth_bp, url_prefix="/auth")
20
  app.register_blueprint(courses_bp, url_prefix="/courses")
21
  app.register_blueprint(feedback_bp, url_prefix="/feedback")
22
  app.register_blueprint(profile_bp, url_prefix="/profile")
23
  app.register_blueprint(admin_bp, url_prefix="/admin")
24
-
25
  @app.route("/")
26
  def home():
27
  return {"status": "Backend running"}
28
-
29
  @app.route("/seed-db")
30
  def seed_db():
31
  try:
32
  import seed
 
33
  return {"status": "Seeding completed!"}
34
  except Exception as e:
35
  return {"status": "Seeding failed", "error": str(e)}
36
-
37
  @app.route("/test-db")
38
  def test_db():
39
  try:
 
40
  return {
41
  "status": "Connected to MongoDB",
42
  "users_count": db["users"].count_documents({}),
@@ -44,6 +46,7 @@ def test_db():
44
  "feedback_count": db["feedback"].count_documents({})
45
  }
46
  except Exception as e:
 
47
  return {"status": "DB connection failed", "error": str(e)}
48
 
49
  # ✅ Debug route to check env vars
 
15
  from routes.feedback import feedback_bp
16
  from routes.profile import profile_bp
17
  from routes.admin import admin_bp
18
+ print("running the routes")
19
  app.register_blueprint(auth_bp, url_prefix="/auth")
20
  app.register_blueprint(courses_bp, url_prefix="/courses")
21
  app.register_blueprint(feedback_bp, url_prefix="/feedback")
22
  app.register_blueprint(profile_bp, url_prefix="/profile")
23
  app.register_blueprint(admin_bp, url_prefix="/admin")
24
+ print("completed teh routes ")
25
  @app.route("/")
26
  def home():
27
  return {"status": "Backend running"}
28
+ print("running teh seed")
29
  @app.route("/seed-db")
30
  def seed_db():
31
  try:
32
  import seed
33
+ print("in teh seed")
34
  return {"status": "Seeding completed!"}
35
  except Exception as e:
36
  return {"status": "Seeding failed", "error": str(e)}
37
+ print("completed teh seed and testing")
38
  @app.route("/test-db")
39
  def test_db():
40
  try:
41
+ print("testing completed")
42
  return {
43
  "status": "Connected to MongoDB",
44
  "users_count": db["users"].count_documents({}),
 
46
  "feedback_count": db["feedback"].count_documents({})
47
  }
48
  except Exception as e:
49
+ print("exception handling of test")
50
  return {"status": "DB connection failed", "error": str(e)}
51
 
52
  # ✅ Debug route to check env vars