Mercurial > hg-website
changeset 405:4dfad479ee98
Properly serve static files in static/$FILE directly
author | David Soria Parra <davidsp@fb.com> |
---|---|
date | Tue, 11 Mar 2014 15:17:05 -0700 |
parents | ba56a7021f6d |
children | c5efd57859d6 |
files | hgwebsite.py robots.txt static/hgicon.png static/robots.txt |
diffstat | 4 files changed, 21 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/hgwebsite.py Tue Mar 11 14:51:39 2014 -0700 +++ b/hgwebsite.py Tue Mar 11 15:17:05 2014 -0700 @@ -20,10 +20,13 @@ flask.abort(404) root = os.path.dirname(os.path.abspath(__file__)) tpath = os.path.join(root, 'templates', site, 'index.html') - if not os.path.exists(tpath): - flask.abort(404) - t = os.path.join(site, 'index.html') - return flask.render_template(t) + if os.path.exists(tpath): + t = os.path.join(site, 'index.html') + return flask.render_template(t) + spath = os.path.join(root, 'static', site) + if os.path.exists(spath): + return app.send_static_file(site) + flask.abort(404) if os.getenv("HGWEBSITE_DEBUG", None):
--- a/robots.txt Tue Mar 11 14:51:39 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -User-agent: * -Crawl-delay: 100 -Disallow: /hg -Disallow: /repo -Disallow: /bts/issue? - -User-agent: geniebot -Disallow: / - -User-agent: ShopWiki -Disallow: / - -User-agent: DotBot -Disallow: /
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/static/robots.txt Tue Mar 11 15:17:05 2014 -0700 @@ -0,0 +1,14 @@ +User-agent: * +Crawl-delay: 100 +Disallow: /hg +Disallow: /repo +Disallow: /bts/issue? + +User-agent: geniebot +Disallow: / + +User-agent: ShopWiki +Disallow: / + +User-agent: DotBot +Disallow: /