Windows環境下使用Apache+mod

來源:互聯網
上載者:User

標籤:apach   檔案   return   ret   text   mod   ide   url   not   

1、安裝Python和Apache。

2、安裝mod_wsgi後獲得wsgi.so,並將wsgi.so放到Apache的modules檔案夾下。

3、安裝webpy。

4、開啟httpd.conf(在Apache的conf檔案夾下)

在檔案的最後加上:

 

 LoadModule wsgi_module /modules/mod_wsgi.so

WSGIScriptAlias /webapp "D:/develop/webapp/index.py/" Alias /webapp/static "D:/develop/webapp/static/"AddType text/html .py <Directory "D:/develop/webapp/">    AllowOverride all    Options Indexes FollowSymLinks  ExecCGI    Order allow,deny    SetHandler wsgi-script    Allow from all</Directory>

 

訪問localhost/webapp,就可以訪問D:/develop/webapp/index.py

index.py:

import web        urls = (    ‘/(.*)‘, ‘hello‘)app = web.application(urls, globals())class hello:            def GET(self, name):        if not name:             name = ‘World‘        return ‘Hello, ‘ + name + ‘!‘if __name__ == "__main__":    app.run()

 

若不可以訪問可以嘗試開啟防火牆:

控制台-》系統安全-》允許程式通過Windows防火牆-》允許運行另一程式

添加Apache的bin檔案夾httpd.exe,並把後面的兩個勾打上。

 

Windows環境下使用Apache+mod

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.