Extremely simple Python CGI framework for Apache 2.
Project description
Python CGI
Extremely simple Python CGI framework for Apache 2.
Hierarchy
pythoncgi
|---- _SERVER
|---- _GET
|---- _POST
|---- _SESSION
|---- _COOKIE
|---- _HEADERS
|---- set_status()
|---- set_header()
|---- execute()
|---- print()
|---- main()
|---- log_construct()
'---- log()
Example
# add .py cgi handler in apache
# allow executecgi in apache
sudo nano index.py
sudo chmod +rwx index.py
###index.py
#!/usr/bin/python3
from pythoncgi import _SERVER, _GET, _POST, _SESSION, _COOKIE, _HEADERS, set_status, set_header, execute, print, main, log_construct, flush
@execute("get")
def get():
set_status(500)
set_header("Cache-Control", "max-age=0, must-revalidate")
print("_SERVER:<br>")
print(_SERVER)
print()
print("_GET:<br>")
print(_GET)
print()
print("_POST:<br>")
print(_POST)
print()
print("_SESSION:<br>")
print(_SESSION)
print()
print("_COOKIE:<br>")
print(_COOKIE)
print()
print("_HEADERS:<br>")
print(_HEADERS)
print()
mylogger = log_construct("mylog.log")
mylogger("done")
if __name__ == '__main__':
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pythoncgi-0.0.28.tar.gz
(17.5 kB
view hashes)
Built Distribution
pythoncgi-0.0.28-py3-none-any.whl
(30.6 kB
view hashes)
Close
Hashes for pythoncgi-0.0.28-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c47d6c2007a14d8daa0658f02a820e3794b898d5c52be4d9c8606f41c60bad0 |
|
MD5 | 4a4b32eaab70cda96fecc796a773814a |
|
BLAKE2b-256 | ba5ff0fd09110ce29c66dd827a75656e3ac1a412f6d959f2896f5c284f9ed69a |