Sure. cgi
is a utility module with no magic powers; it does nothing you can't do yourself by reading and processing environment variables (in particular QUERY_STRING
) and stdin
, which comes into play for POST
form bodies. (But remember to read the CONTENT_LENGTH
environment variable and only read that many bytes, rather than using readlines()
, else you can make your script hang waiting for more input that will never come.)
Indeed, there are complete alternatives to cgi
for form submission processing, either as standalone modules or as part of a framework.
cgi
module or no, however, I wouldn't write a purely CGI-based webapp today. Much better to write to the WSGI interface, and use wsgiref.handlers.CGIHandler
to deploy that WSGI app over CGI. Then you can easily migrate to a more efficient web server interface as and when you need to. You can use the cgi
module inside a WSGI app to read form submissions if you like, or, again, do your own thing.