Youcef Kias نشر 5 يوليو 2025 أرسل تقرير نشر 5 يوليو 2025 good, but how to make login and register sent you to prediction site instead of dashboard,, and also make the information go to dbgate project.zip اقتباس
0 محمد عاطف25 نشر 6 يوليو 2025 أرسل تقرير نشر 6 يوليو 2025 هل تقصد أن يتم إعادة توجيه المستخدم عند تسجيل الدخول أو إنشاء حساب جديد إلى صفحة ال predict ؟ إذا كان كذلك فيجب عليك في ملف auth.py أن تقوم بإعادة التوجيه إلى auth.predictفي login . وفي register تقوم أولا بتسجيل دخول المستخدم بعد إنشاءه وبعدها تقوم بتوجيه هكذا : from flask import Blueprint, render_template, request, redirect, url_for, flash from flask_login import login_user, logout_user, login_required from models import db, User bp = Blueprint('auth', __name__) @bp.route('/register', methods=['GET', 'POST']) def register(): if request.method == 'POST': u, p = request.form['username'], request.form['password'] if User.query.filter_by(username=u).first(): flash('اسم المستخدم موجود') else: user = User(username=u) user.set_password(p) db.session.add(user) db.session.commit() flash('تم التسجيل') login_user(user) return redirect(url_for('auth.predict')) return render_template('register.html') @bp.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': u = User.query.filter_by(username=request.form['username']).first() if u and u.check_password(request.form['password']): login_user(u) return redirect(url_for('auth.predict')) flash('بيانات غير صحيحة') return render_template('login.html') @bp.route('/predict', methods=['GET']) @login_required def predict(): return render_template('predict.html') @bp.route('/logout') def logout(): logout_user() return redirect(url_for('auth.login')) def load_user(user_id): return User.query.get(int(user_id)) وإنه بالفعل يتم حفظ البيانات في قاعدة البيانات ويجب أن تظهر لك في dbGate ولكن تأكد من الإتصال بقاعدة البيانات الصحيحة . فلو ذهبت إلى dashboard ستجد أنه يتم إعادة السجلات السابقة بالتنبؤ لهذا المستخدم. اقتباس
0 Youcef Kias نشر 6 يوليو 2025 الكاتب أرسل تقرير نشر 6 يوليو 2025 it save only the user name not the prediction اقتباس
0 محمد عاطف25 نشر 6 يوليو 2025 أرسل تقرير نشر 6 يوليو 2025 بتاريخ 7 دقائق مضت قال Youcef Kias: it save only the user name not the prediction يتم حفظ التنبؤ والإحتمالات في جدول prediction : وإذا ذهبت إلى : http://127.0.0.1:5000/dashboard ستجد أنه يحضر النتائج التي تم حفظها في جدول prediction : إذا أردت حفظ أى بيانات أخرى يمكنك تعديل الجدول بما تريده وإضافة البيانات في ملف api.py في هذا السطر : pr = Prediction(result=y, proba=probs, user=current_user._get_current_object()) اقتباس
0 Youcef Kias نشر 6 يوليو 2025 الكاتب أرسل تقرير نشر 6 يوليو 2025 where to put it, it give me this اقتباس
0 محمد عاطف25 نشر 6 يوليو 2025 أرسل تقرير نشر 6 يوليو 2025 بتاريخ 2 ساعة قال Youcef Kias: where to put it, it give me this السطر موجود بالفعل في ملف api ما أقصده لو أردت إضافة بيانات أكثر يمكنك تعديل هذا السطر وتمرير البيانات له بعد تعديل قاعدة البيانات. ولكن بالفعل يتم إضافة البيانات إلى قاعدة البيانات ولا حاجة إلى تعديل الكود لو لم تريد إضافة أى شئ أخر. اقتباس
السؤال
Youcef Kias
good, but how to make login and register sent you to prediction site instead of dashboard,, and also make the information go to dbgate
project.zip
5 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.