In this article “Rui Santos” shows us how to configure Raspberry Pi as server and use it to toggle two LEDs over the internet.
In this project you’ll create a standalone web server with a Raspberry Pi that can toggle two LEDs. You can replace those LEDs with any output (like a relay or a transistor). In order to create the web server you will be using a Python microframework called Flask.
Raspberry Pi Web Server using Flask to Control GPIOs – [Link]