Projects‎ > ‎

HTTP Server in Python

Learn the Python programming language. Implement an HTTP server.

Your server must:
  • respond to GET requests by serving pages from a specified folder
  • validate requested paths to ensure only files from the specified folder (and sub-directories) are served
  • use an INI file for configuration purposes
    • which folder to serve pages from?
    • what port to listen on?
  • write to a log file
    • who is accessing your server?
    • what pages are they GETting?
 Python has handy modules which will help you immensely for this project:
As always, you are free to use any modules from the standard library. This includes the modules above. You are free to model your code after the test cases provided as part of the Python standard library. However, you are not allowed to use code from anywhere else, or to cut and paste code from the standard library. All code submitted should be your own work and rely solely on the standard library using import statements.

In other words, the only code I see should be authored by you, but you may import anything I would normally have in my Python environment.


To submit your project for grading, run your server on your virtual machine. Configure your server to listen on port 8001 and to serve your code. When I point my browser at your site, I should see a directory listing including your python code and INI file (other files are fine too). Make sure your server runs continuously, even after you log off. It should run continuously for at least a week after it is due.

You do not need to comment or document your code, but it should be organized logically so I can read it easily. I will verify that your code works and meets the project requirements.