diff --git a/scrapyd/tests/test_website.py b/scrapyd/tests/test_website.py index 6f00a1a6..e1706448 100644 --- a/scrapyd/tests/test_website.py +++ b/scrapyd/tests/test_website.py @@ -24,10 +24,10 @@ def test_render_home(self, txrequest, site_no_egg): content = site_no_egg.children[b''].render_GET(txrequest) expect_headers = { b'Content-Type': [b'text/html; charset=utf-8'], - b'Content-Length': [b'704'], + b'Content-Length': [b'714'], } if site_no_egg.local_items: - expect_headers[b'Content-Length'] = [b'740'] + expect_headers[b'Content-Length'] = [b'751'] headers = dict(txrequest.responseHeaders.getAllRawHeaders()) diff --git a/scrapyd/website.py b/scrapyd/website.py index 6bdfb44c..9442fc8a 100644 --- a/scrapyd/website.py +++ b/scrapyd/website.py @@ -71,25 +71,31 @@ 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 = """ + s = """\ Scrapyd

Scrapyd

-

Available projects: %(projects)s

- +""" % vars + if self.root.scheduler.list_projects(): + s += '

Available projects:

\n

\n' + else: + s += '

No projects available.

\n' + s += """

How to schedule a spider?

To schedule a spider you need to use the API (this web UI is only for