[英]“malformed htpasswd file” error message when starting pypi-server
When starting the pypi-server I get an error message saying " malformed htpasswd file ". 启动pypi服务器时 ,出现错误消息,提示“ 格式错误的htpasswd文件 ”。 I get the error message even if the .htpasswd file does not exist.
即使.htpasswd文件不存在,我也会收到错误消息。 What is causing the error?
是什么导致错误?
Here is the entire 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)
I have the following folder structure: 我具有以下文件夹结构:
C:\Data\packages\.htaccess
C:\Data\packages\.htpasswd
The content of the .htaccess file is: .htaccess文件的内容是:
AuthName "Under Development"
AuthUserFile C:\Data\packages\.htpasswd
AuthType basic
Require valid-user
The content of the .htpasswd file is: .htpasswd文件的内容是:
user:$apr1$zYBRb3n6$PBrNqfGoyb9ZQC5hGuRJN0
The pypiserver does not support .htaccess
files; pypiserver不支持
.htaccess
文件。 this is an Apache-only feature. 这是仅Apache的功能。 it just reuses the
.htpasswd
file-format from Apache. 它只是重用了Apache的
.htpasswd
文件格式。
Additionally, the htpasswd
file is better not to be located inside the packages
folder, to be impossible for pypiserver to serve it by mistake, and reveal thus its contents. 另外,
htpasswd
文件最好不要位于packages
文件夹内, 否则pypiserver不可能错误地提供它,从而揭示其内容。
So move the htpasswd file eg to the parent folder, remove the dot prefix (no need to be hidden/special), and change the startup command: 因此,将htpasswd文件移动到父文件夹,删除点前缀(无需隐藏/特殊),然后更改启动命令:
move packages\.htpasswd .\htpasswd
del packages\.htaccess
pypiserver -p 8080 -P htpasswd packages
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.