from app import create_app, db
from app.models import User

app = create_app()
with app.app_context():
    try:
        # Try to query for a user
        user = User.query.filter_by(username='admin').first()
        print(f"Query successful: {user}")
    except Exception as e:
        print(f"Error during query: {e}")
        import traceback
        traceback.print_exc()