Study the source of existing sites you like. Then start writing your own Python framework upward to recreate (and fast transcend) them. Extensively study the existing frameworks, especially when you hit a conceptual or implementational roadblock. Understand everything you have to work with at each step. Keep building up.