from app import app, db, User, bcrypt # Create the default user username = 'admin' password = '1234' hashed_password = bcrypt.generate_password_hash(password).decode('utf-8') with app.app_context(): # Delete the existing user if it exists existing_user = User.query.filter_by(username=username).first() if existing_user: db.session.delete(existing_user) db.session.commit() # Add the new user to the database default_user = User(username=username, password=hashed_password, role='admin') db.session.add(default_user) db.session.commit() print(f"Default user '{username}' created with password '{password}'")