0
|
1 import sys
|
|
2 import os
|
|
3 from mercurial import demandimport
|
|
4 demandimport.enable()
|
|
5 # 设置编码为UTF-8
|
|
6 if not isinstance(os.environ.get('PYTHONIOENCODING'), str):
|
|
7 os.environ['PYTHONIOENCODING'] = 'utf-8'
|
|
8 from mercurial.hgweb.hgwebdir_mod import hgwebdir
|
|
9 # 确保配置文件路径正确
|
|
10 config_path = '/var/hg/hgweb.config'
|
|
11 if not os.path.isabs(config_path):
|
|
12 config_path = os.path.join(os.getcwd(), config_path)
|
|
13 # 确保路径是字节串,以防 Mercurial 需要字节串路径
|
|
14 config_path_bytes = config_path.encode('utf-8')
|
|
15 application = hgwebdir(config_path_bytes) |