# HG changeset patch # User David Soria Parra # Date 1394576225 25200 # Node ID 4dfad479ee98f07016620835c8d6243e549714fb # Parent ba56a7021f6d09134427a9e91ab20e8161d5d420 Properly serve static files in static/$FILE directly diff -r ba56a7021f6d -r 4dfad479ee98 hgwebsite.py --- 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): diff -r ba56a7021f6d -r 4dfad479ee98 robots.txt --- 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: / diff -r ba56a7021f6d -r 4dfad479ee98 static/hgicon.png Binary file static/hgicon.png has changed diff -r ba56a7021f6d -r 4dfad479ee98 static/robots.txt --- /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: /