Skip to content

Commit 74f65cb

Browse files
Update app.py
1 parent a1b7b7e commit 74f65cb

1 file changed

Lines changed: 0 additions & 33 deletions

File tree

‎app.py‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,6 @@ def home():
1919
@login_required
2020
def dashboard():
2121
return render_template("dashboard.html")
22-
# ============================================================
23-
# TEMPORARY ROUTE: First Admin Setup (Fixed)
24-
# ============================================================
25-
@app.route("/setup-admin-xyz")
26-
def setup_admin_xyz():
27-
try:
28-
from database import db_select, db_insert
29-
from werkzeug.security import generate_password_hash
30-
31-
# 1. Check karo ki admin pehle se bana hai ya nahi
32-
rows = db_select("admins", {"username": "admin"})
33-
if rows:
34-
return "Admin pehle se bana hua hai! Ab is route ko delete kar dena."
35-
36-
# 2. Direct admin insert karo
37-
db_insert("admins", {
38-
"username": "admin",
39-
"password_hash": generate_password_hash("admin123"),
40-
"full_name": "Principal",
41-
"role": "super_admin",
42-
"is_active": True
43-
})
44-
45-
return "✅ Admin successfully ban gaya!<br>Username: admin<br>Password: admin123<br><br><b>Ab is route ko app.py se hata dena!</b>"
46-
47-
except Exception as e:
48-
import traceback
49-
return f"""
50-
<h2>❌ Error Aaya:</h2>
51-
<p style="color:red; font-weight:bold;">{str(e)}</p>
52-
<h3>Full Details:</h3>
53-
<pre style="background:#f4f4f4; padding:10px;">{traceback.format_exc()}</pre>
54-
"""
5522

5623
if __name__ == "__main__":
5724
app.run(host="0.0.0.0", port=int(os.getenv("PORT", 5000)))

0 commit comments

Comments
 (0)