, , .
hgwebdir - wsgi , , wsgi, mod_wsgi apache2. mod_wsgi , cgi, python , .
, wsgi middleware URL - ..
, , trac ( wsgi), trac hgwebdir, , , , repoze.who.
, python paste - , , hgwebdir .
"""
Wsgi wrapper of hgweb that is paste compatible
"""
import os
from mercurial import demandimport
demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir
CONFIG_FILE_KEY = "hgwebdir.config"
def hgweb_paste(global_config, **local_conf):
"""
looking for a config file setting in global or local
"""
cfg = global_config
cfg.update(local_conf)
config_file = cfg.get(CONFIG_FILE_KEY)
if config_file and os.path.exists(config_file):
return hgwebdir(config_file)
else:
raise KeyError, "%s not set or %s does not exist" % (CONFIG_FILE_KEY,config_file)
, ...
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 6543
[app:main]
use = egg:hg.paste#hgweb
hgwebdir.config = %(here)s/hg.config