在不完全明白之前,看別人的帖子總是覺得是錯的,等到弄懂以后,怎么看都是對的。
正題:

安裝mod_wsgi,然后記得在http.conf文件里面添加以下一行:
LoadModule wsgi_module modules/mod_wsgi.so
此時的apache就是wsgi服務(wù)器了。也許有人會問什么是wsgi服務(wù)器。
# -*- coding: utf-8 -*- from wsgiref import simple_server 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] # 下面兩行就是簡單的wsgi服務(wù)器 server = simple_server.make_server(\'localhost\', 8080, application) server.serve_forever()
注意這行:server = simple_server.make_server(\'localhost\', 8080, application) 的參數(shù)application。這在apache里肯定無法編譯進去,所以需要你在你的虛擬主機配置文件的
WSGIScriptAlias / /path/to/your/main.wsgi
行指出,而文件/path/to/your/main.wsgi的內(nèi)容可能如下:
def application(environ, start_response): status = \'200 OK\' output = \'<h1>Hello World!</h1>\' response_headers = [(\'Content-type\', \'text/plain\'), (\'Content-Length\', str(len(output)))] start_response(status, response_headers) return [output] 或者
WSGIScriptAlias / /path/to/your/site/wsgi.py
然后wsgi.py就是django自動生成的文件。
標題名稱:apache+mod_wsgi+django配置
當前路徑:http://chinadenli.net/article14/cggpde.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、網(wǎng)站收錄、定制開發(fā)、網(wǎng)站營銷、企業(yè)建站、網(wǎng)頁設(shè)計公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)