Python on the web: How to use Environment variables to detect script path

If you are writing Python scripts to run from the cgi-bin of your website, here is some code that will allow the script to detect it’s own path, so that it doesn’t have to be hard coded. The preferable way is to use the environment variable ‘SCRIPT_URI’. For example: this_script = os.environ[‘script_uri’] Note: Depending on … Continue reading Python on the web: How to use Environment variables to detect script path