Mercurial > hg-website
diff hgwebsite.py @ 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 | 4d4c4b73808e |
children | 8e93934dc587 |
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):