Mercurial > hg-website
comparison hgwebsite.py @ 401:4d4c4b73808e
Use absolute paths
author | David Soria Parra <dsp@php.net> |
---|---|
date | Sat, 08 Mar 2014 02:03:33 +0000 |
parents | 20cfd68e9c49 |
children | 4dfad479ee98 |
comparison
equal
deleted
inserted
replaced
400:20cfd68e9c49 | 401:4d4c4b73808e |
---|---|
16 | 16 |
17 @app.route('/<site>') | 17 @app.route('/<site>') |
18 def about(site=None): | 18 def about(site=None): |
19 if not site: | 19 if not site: |
20 flask.abort(404) | 20 flask.abort(404) |
21 tpath = os.path.join('templates', site, 'index.html') | 21 root = os.path.dirname(os.path.abspath(__file__)) |
22 tpath = os.path.join(root, 'templates', site, 'index.html') | |
22 if not os.path.exists(tpath): | 23 if not os.path.exists(tpath): |
23 flask.abort(404) | 24 flask.abort(404) |
24 t = os.path.join(site, 'index.html') | 25 t = os.path.join(site, 'index.html') |
25 return flask.render_template(t) | 26 return flask.render_template(t) |
26 | 27 |