show some minimal information for /

This commit is contained in:
Ralf Schmitt 2011-08-01 00:34:38 +02:00
parent 22213a787e
commit 74ff96387c
1 changed files with 25 additions and 2 deletions

View File

@ -44,8 +44,30 @@ class pkgset(object):
@route('/')
def root():
return request.url
redirect("/simple/")
try:
numpkgs = len(packages.find_packages())
except:
numpkgs = 0
return """<html><head><title>Welcome to pypiserver!</title></head><body>
<h1>Welcome to pypiserver!</h1>
<p>This is a PyPI compatible package index serving %(NUMPKGS)s packages.</p>
<p> To use this server with pip, run the the following command:
<blockquote><pre>
pip install -i %(URL)ssimple PACKAGE [PACKAGE2...]
</pre></blockquote></p>
<p> To use this server with easy_install, run the the following command:
<blockquote><pre>
easy_install -i %(URL)ssimple PACKAGE
</pre></blockquote></p>
<p>The complete list of all packages can be found <a href="/packages/">here</a> or via the <a href="/simple/">/simple</a> index.</p>
<p>This instance is running version %(VERSION)s of the <a href="http://pypi.python.org/pypi/pypiserver">pypiserver</a> software.</p>
</body></html>
""" % dict(URL=request.url, VERSION=__version__, NUMPKGS=numpkgs)
@route("/simple")
@ -73,6 +95,7 @@ def simple(prefix=""):
return "".join(res)
@route('/packages')
@route('/packages/')
def list_packages():
files = packages.find_packages()