Skip to main content

Python CGI Server - Perfect To Deliver PHP Files Within A Python CherryPy Application

Project description

Mit dem CherryPy Tool cherrypy-cgiserver kann man aus CherryPy einen vollwertigen CGI-Server (Common Gateway Interface) machen. Damit lassen sich sogar PHP-Dateien ausführen und ausliefern. Es muss nur der PHP-Interpreter auf dem Computer installiert sein. Ein zusätzlicher Apache-Server ist nicht nötig.

So einfach lässt sich aus CherryPy ein vollwertiger PHP-Server machen:

#!/usr/bin/env python
# coding: utf-8

import os
import cherrypy
import cpcgiserver

THISDIR = os.path.dirname(os.path.abspath(__file__))

def main():
    config = {
        "global": {
            "server.socket_host": "0.0.0.0",
            "server.socket_port": 8080,
        },
        "/": {
            "tools.cgiserver.on": True,
            "tools.cgiserver.dir": THISDIR,
            "tools.cgiserver.base_url": "/",
            "tools.cgiserver.handlers": {".php": "/usr/bin/php-cgi"},
        }
    }
    app = cherrypy.Application(None, config = config)
    cherrypy.quickstart(app, config = config)

if __name__ == "__main__":
    main()

Installation

pip install cherrypy-cgiserver or easy_install cherrypy-cgiserver

Lizenzen

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cherrypy-cgiserver-0.3.6.tar.gz (50.5 kB view details)

Uploaded Source

File details

Details for the file cherrypy-cgiserver-0.3.6.tar.gz.

File metadata

File hashes

Hashes for cherrypy-cgiserver-0.3.6.tar.gz
Algorithm Hash digest
SHA256 c98a57597bb461d02ae71d9a41e1756dc5bb36298dc917e71c84363c72275ce9
MD5 fa94f1a68843021a887af7c989d82d6e
BLAKE2b-256 fdc1ee6a93f55b301ad190859c48a1269cd448673ba75ec501afb4fd6741f569

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page