Heat olive oil over medium heat. Add onion, green pepper and red pepper. Cook for 10 to 12 minutes, or until tender. Add garlic and cook 30 seconds. Add beans, tomato puree, olives, basil, and red pepper flakes. Salt and pepper to taste. Bring to a boil and reduce heat to a simmer. Simmer uncovered for 20 minutes.
Cook spaghetti according to package directions and drain. Place spaghetti on a serving platter and top with bean mixture. Top with Parmesan cheese if desired.