view Mercurial/hgweb.wsgi.exmaple @ 0:edd512324c03

Add:Mercurial Files
author Pluto <meokcin@gmail.com>
date Tue, 03 Sep 2024 16:30:52 +0800
parents
children
line wrap: on
line source

import sys
import os
from mercurial import demandimport
demandimport.enable()
# 设置编码为UTF-8
if not isinstance(os.environ.get('PYTHONIOENCODING'), str):
os.environ['PYTHONIOENCODING'] = 'utf-8'
from mercurial.hgweb.hgwebdir_mod import hgwebdir
# 确保配置文件路径正确
config_path = '/var/hg/hgweb.config'
if not os.path.isabs(config_path):
config_path = os.path.join(os.getcwd(), config_path)
# 确保路径是字节串,以防 Mercurial 需要字节串路径
config_path_bytes = config_path.encode('utf-8')
application = hgwebdir(config_path_bytes)
备案号:苏ICP备2024087954号-2 | 渝公网安备50010402001513