Spray a deep-dish pie pan, 9x9-inch baking pan, or 8x8-inch baking pan with non-stick spray.
Preheat oven to 350°F
Cook spaghetti and drain
Add ricotta and eggs to spaghetti while spaghetti is still hot and stir until combined.
Pour the spaghetti mixture into a pie pan and form it into a crust. Compact it down with the bottom of another pie pan or saucer.
In a skillet cook ground beef, onions, and garlic. Drain fat.
To the beef mixture, add tomatoes (do not drain), tomato paste, Italian seasoning, and sugar. Bring to a boil. Turn to simmer and allow it to simmer for 15 minutes.
Spoon the beef mixture evenly over spaghetti crust.
Top with mozzarella and then Parmesan cheeses.
Bake in 350° oven for 20 minutes or until hot, bubbly and the cheese is melted. Cool for 5 minutes before cutting.