{"id":19358850,"url":"https://github.com/kathan/py-cgi","last_synced_at":"2026-06-11T22:31:28.872Z","repository":{"id":95303869,"uuid":"104150963","full_name":"kathan/py-cgi","owner":"kathan","description":"Python CGI process manager.","archived":false,"fork":false,"pushed_at":"2018-11-09T19:36:10.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T12:15:07.615Z","etag":null,"topics":["python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kathan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-20T01:44:09.000Z","updated_at":"2018-11-09T19:36:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"b2fb2a07-73bf-4ce2-99fa-b5f64374c32b","html_url":"https://github.com/kathan/py-cgi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kathan/py-cgi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathan%2Fpy-cgi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathan%2Fpy-cgi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathan%2Fpy-cgi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathan%2Fpy-cgi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kathan","download_url":"https://codeload.github.com/kathan/py-cgi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathan%2Fpy-cgi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34221150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python"],"created_at":"2024-11-10T07:13:19.685Z","updated_at":"2026-06-11T22:31:28.856Z","avatar_url":"https://github.com/kathan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py-cgi  - Python CGI process manager\r\npy-cgi is a Python CGI process manager, similar to php-fpm, for executing python scripts behind NGINX or Apache. Comes in handy if you want to run python along side PHP, node.js or if you don't want to write your own web server into your python application. This is similar to [js-cgi](https://github.com/kathan/js-cgi)\r\n\r\n### Dependencies:\r\n* gunicorn\r\n* gevent\r\n* monkey\r\n\r\n### Install dependencies\r\n```\r\npip install gevent\r\npip install gunicorn\r\npip install monkey\r\n```\r\n\r\n### NGINX Config:\r\nAdd a directive to your `nginx.conf` file.\r\n```\r\nlocation ~ [^/]\\.py(/|$) {\r\n    proxy_connect_timeout            10000;\r\n    proxy_send_timeout               10000;\r\n    proxy_read_timeout               10000;\r\n    send_timeout                     10000;\r\n    client_body_timeout              10000;\r\n    proxy_pass                       http://localhost:8091;\r\n    proxy_set_header X-Real-IP       $remote_addr;\r\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n    proxy_set_header Host            $http_host;\r\n    proxy_set_header path_translated $document_root$fastcgi_path_info;\r\n}\r\n```\r\n\r\nOnce you configure and restart NGINX, you can start py-cgi.\r\n```sh\r\ngunicorn -b :8091 -w 4 -k gevent --worker-connections=2000 --backlog=1000 -p gunicorn.pid py-cgi:app\r\n```\r\n### Usage:\r\nAny .py file that is beneath the NGINX root folder will be imported and execute when it is accessed by NGINX. Each file must have a cgi method that will be called as the insertion point. The text that is returned will be sent to the browser.\r\n```py\r\ndef main(environ, resp_head):\r\n    resp_head.append((\"Content-Type\", \"text/html\"))\r\n    return \"hello world!\"\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkathan%2Fpy-cgi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkathan%2Fpy-cgi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkathan%2Fpy-cgi/lists"}