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.20.tar.gz
(17.5 kB
view hashes)
Built Distribution
pythoncgi-0.0.20-py3-none-any.whl
(30.5 kB
view hashes)
Close
Hashes for pythoncgi-0.0.20-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e251639bd33cda070e8a0edcc74ce9e1e6330a06457d2b7424dae3e3a8b446d |
|
MD5 | 63b62c686238b395ee3f502690e0117d |
|
BLAKE2b-256 | 758f3cb64ed8b9841a44cd23c4ee8b08942fda9badedb0eedb4d04d3525da649 |