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.30.tar.gz
(17.5 kB
view hashes)
Built Distribution
pythoncgi-0.0.30-py3-none-any.whl
(30.6 kB
view hashes)
Close
Hashes for pythoncgi-0.0.30-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93e8743ee0470cbc7f814d7aba9718b0bc2278fd843084418645e6f9517cc99a |
|
MD5 | 2b419cc3a1fb192e95af40043140ef2a |
|
BLAKE2b-256 | bda113a9c7269b5f0965a23cc469308b366e3589ffdcec0b2f1320c693f67d43 |