簡體   English   中英

在mod_wsgi上設置我的cgi腳本

[英]setting up my cgi script on mod_wsgi

我有一個基本的cgi腳本,可以從mod_wsgi中調用它。 我已經在mod_wsgi上建立了一個基本的hello world示例。 如何在mod_wsgi上設置cgi腳本?

我知道這里有一個稱為“應用程序”的應用程序入口點,但是如何從此處運行我的腳本?

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'

    response_headers = [('Content-type', 'text/plain'),
    ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

我的cgi腳本包含許多導入,松散的代碼,定義和打印語句。

Mercurial包含一個CGI到WSGI的橋接模塊,可以在這里找到:

http://hg.intevation.org/mercurial/crew/file/tip/mercurial/hgweb/wsgicgi.py

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM