I'm writing a Python script that opens a file based on the URL (using .htaccess). I want to be able to open it using an absolute path relative to the servers DocumentRoot. With PHP I would do:
$_SERVER['DOCUMENT_ROOT']/path
Is there a similar function with CGI?
Thanks.
I finally found the solution, just use:
import os
os.environ['CONTEXT_DOCUMENT_ROOT']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.