PageRank



轉移公告

計劃把 http://blog.hoamon.info/ 文章全部轉移至 http://www.hoamon.info/blog/ 這裡,而本 Blogger 站台的文章近 500 篇,我預計在 2014-12-31 前移轉完畢,完成後 http://blog.hoamon.info/ 將只作代轉服務,一律把舊連結如 http://blog.hoamon.info/index.html 轉成 http://www.hoamon.info/blog/index.html ,敬請舊雨新知互相走告。

新文章只發佈在 http://www.hoamon.info/blog/

何岳峰 敬上
顯示具有 mod_python 標籤的文章。 顯示所有文章
顯示具有 mod_python 標籤的文章。 顯示所有文章

2012年9月18日 星期二

轉移至 Nginx

2012 三月全世界的網頁伺服器市佔率圖 from netcraft.com 

上圖可以看出歷久彌新的 Apache 持續雄距首位,有超過 15 年的時間,沒"器"可挑戰它的地位。直至 Nginx 的出現,或許它現在只有 10% ,但從各方評價看來,它絕對是 Apache 有史以來最強大的對手。短短 5 年,它已經爬上第 3 名的位子,從趨勢線上看來,要超越 IIS 也是有很大的機會。

閱讀更多

2009年2月11日 星期三

把 Mercurial 用 mod_python 裝在 Apache 中

實際上, Mercurial 這種分散式版本控制器是不太需要架個 Web Server 來 Run 的,尤其是我多半都是獨自在寫程式,但架了個 Web Server 後,我會比較方便在多台個人電腦中轉移陣地,且這也多了一種備份的機制。

不過,目前已有人將 hg 成功移植成 GAE 版(hg-repos.appspot.com),現在只待作者把說明文件完成,我就會將跑在 apache 上的部份儲存庫再移至 GAE 去。

廢話不多說,透過 mod_python 來跑 HTTPS 版的 Mercurial 儲存庫方式如下:

一、 下載 modpython_gateway.py ,載點何處? Google 比較快且安全。下載後放到 /raid1/A2B2/www/HG/ (可自行更換其他資料夾) ,也就是在 apache.conf 中所設定 PythonPath 。此檔案內容不用修改。

二、 設定如何執行 modpython_gateway.py ,一樣在 /raid1/A2B2/www/HG/ 下,新增一個 hgwebdir.py ,其內容如下:

import os
os.environ["HGENCODING"] = "UTF-8"

from mercurial.hgweb.hgweb_mod import hgweb
from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import wsgiapplication

def make_web_app():
return hgwebdir("/raid1/A2B2/www/HG/hgweb.config")

def test(environ, start_response):
toto = wsgiapplication(make_web_app)
return toto (environ, start_response)


三、 設定你的檔案庫位置,一樣在 /raid1/A2B2/www/HG 下新增一個 hgweb.config 其內容如下:

[paths]
/trachg = /raid1/A2B2/www/trac/hg

[collections]
#我把 /raid1/A2B2/www/HG/product soft link 到 /product
#這樣在連結上,才會是用 /product/product1 來觀看 product1 儲存庫。
/PathDoesNotMatter = /product/

[web]
style = gitweb
allow_archive = bz2 gz zip


四、 apache.conf 設定如下:

<virtualhost *:443>
--ServerSignature Off
--ServerName hg.yoursite.name
--DocumentRoot /raid1/A2B2/www/HG/tmp
--RewriteEngine On
--RewriteRule ^/(.*) /DoesNotMatter/$1
--<Location />
----PythonPath "sys.path + [ '/raid1/A2B2/www/HG' ]"
----#PythonDebug On #Uncomment this ligne if you got a problem and need debug information
----SetHandler mod_python
----PythonHandler modpython_gateway::handler
----#PythonOption SCRIPT_NAME /repo
----PythonOption wsgi.application hgwebdir::test
----AuthType Basic
----AuthName "Mercurial Repository"
----AuthUserFile /raid1/A2B2/www/auth_users
----Require valid-user
--</Location>
--LogLevel warn
--ErrorLog /var/log/apache2/hg_error.log
--CustomLog /var/log/apache2/hg_access.log combined
--SSLEngine On
--SSLCertificateFile /etc/apache2/ssl/apache.pem
</virtualhost>

五、 重啟 apache

你就會在 https://hg.yoursite.name/ 中,看到 trachg 、 product/product1 、 product/XXXproduct ... 的儲存庫了。

2007年2月27日 星期二

Trac安裝筆記(下)

上一篇文章我們談了使用內建的 Tracd 來執行 Python 的 CGI 程式,本篇文章則是要介紹用 Apache2 + mod_python 來跑 Trac 程式。

事實上,這沒什麼難度,3個步驟就結束了:
  1. 安裝 mod_python
  2. 設定 apache.conf
  3. 設定 .htpasswd
閱讀更多…

2007年2月26日 星期一

Trac安裝筆記(上)

2006年在自由軟體的最佳開發人員協助工具領域獲得評審肯定大獎的 Trac 軟體,是一套結合 Wiki 及 Request Ticket 的網頁程式。

wiki 適合來作規格書的共同開發; RT 則適合作程式專案的回饋追蹤。本來以為只有我會把這兩樣東西合在一起使用,正想裝一個 kwiki 及一個 RT 系統時(真巧兩個都是 Perl 寫的),居然讓我發現這個用 Python 寫的整合系統 Trac ,嘿嘿~世事難料!果然如此。

Trac 官網: http://trac.edgewall.org/ (原 http://trac.edgewall.com/ )
它本來應是一間公司,不過現在改成 .org 的,站上也沒看見任何販賣及商業支援的資訊,應該不會是搞 Python 的,都賺不了錢吧!希望是錢賺太多,不想賺了。

閱讀更多…
Related Posts Plugin for WordPress, Blogger...