启动pypi-server时,我收到一条错误消息,提示“格式错误的 htpasswd 文件”。即使 .htpasswd 文件不存在,我也会收到错误消息。是什么导致了错误?
这是整个 Traceback:
C:\Data>pypi-server -p 8080 -P packages\.htaccess packages
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pypi-server.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\pypiserver\__main__.py", line 293, in main
app = pypiserver.app(**vars(c))
File "c:\python27\lib\site-packages\pypiserver\__init__.py", line 124, in app
config, packages = core.configure(**kwds)
File "c:\python27\lib\site-packages\pypiserver\core.py", line 47, in configure
htPsswdFile = HtpasswdFile(c.password_file)
File "c:\python27\lib\site-packages\passlib\apache.py", line 583, in __init__
super(HtpasswdFile, self).__init__(path, **kwds)
File "c:\python27\lib\site-packages\passlib\apache.py", line 166, in __init__
self.load()
File "c:\python27\lib\site-packages\passlib\apache.py", line 236, in load
self._load_lines(fh)
File "c:\python27\lib\site-packages\passlib\apache.py", line 261, in _load_lines
key, value = parse(line, idx+1)
File "c:\python27\lib\site-packages\passlib\apache.py", line 590, in _parse_record
% lineno)
ValueError: malformed htpasswd file (error reading line 1)
我有以下文件夹结构:
C:\Data\packages\.htaccess
C:\Data\packages\.htpasswd
.htaccess 文件的内容是:
AuthName "Under Development"
AuthUserFile C:\Data\packages\.htpasswd
AuthType basic
Require valid-user
.htpasswd 文件的内容是:
user:$apr1$zYBRb3n6$PBrNqfGoyb9ZQC5hGuRJN0