From the course: Using SQL with Python

Unlock the full course today

Join today to access over 23,300 courses taught by industry experts.

Testing a web application

Testing a web application

- [Instructor] Our final project is a web application, which means that we need to test it in a web server. You could use a free or low-cost server from a cloud company and that would work fine or you may prefer this simple, convenient alternative. Python comes with a functional web server that's ideal for testing. It's not something you would use in production, but it works for our purposes. This is webserver.py, from chapter three of the exercise files. It's a simple web server using the HTTP server module, and this module is included with the default Python distribution. You notice down here on line six, I import two classes from the HTTP server module. These two classes are the server itself and a request handler for CGI and then I set up a class that inherits that request handler and I give it the directories where we're going to run CGI. These directories are relative to the server route, which by default is the…

Contents