You bought your Raspberry Pi, and managed to create a python script to turn on/off an LED via GPIO. Then you are wonder “How can I control the GPIO via a web page”? This is a common questions been asked repeatedly on Raspberry Pi StackExchange and Raspberry Pi user groups. Some would say you need Flask web framework, other would suggest to install LAMP (Linux, Apache, PHP and MySQL), very few aware that you can run a simple HTTP web server using python’s build-in http.server library, without installation of Flask web framework or LAMP stacks.
The complete codes two python examples available at my github.