Skip to content

Commit

Permalink
transparent list of projects #493
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekiewicz authored Sep 22, 2023
1 parent 67a0d21 commit 3e8825e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scrapyd/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ def __init__(self, root, local_items):

def render_GET(self, txrequest):
vars = {
'projects': ', '.join(self.root.scheduler.list_projects()),
'base_path': self.get_base_path(txrequest),
}
s = """
<html>
<head><title>Scrapyd</title></head>
<body>
<h1>Scrapyd</h1>
<p>Available projects: <b>%(projects)s</b></p>
<ul>
<li><a href="%(base_path)s/jobs">Jobs</a></li>
"""
Expand All @@ -90,6 +88,16 @@ def render_GET(self, txrequest):
<li><a href="https://scrapyd.readthedocs.io/en/latest/">Documentation</a></li>
</ul>
<p>Available projects:<p>
""" % vars
if self.root.scheduler.list_projects():
s += '<ul>'
for project_name in sorted(self.root.scheduler.list_projects()):
s += '<li>' + project_name + '</li>'
s += '</ul>'
else:
s += '<b>no projects</b>'
s += """
<h2>How to schedule a spider?</h2>
<p>To schedule a spider you need to use the API (this web UI is only for
Expand Down

0 comments on commit 3e8825e

Please sign in to comment.