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.5.tar.gz (50.4 kB view hashes)

Uploaded Source

Supported by

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