Mercurial > hg-website
view hgwebsite.py @ 472:ef6da0fd2a0c
donate: new page to route donations to conservancy
This isn't linked to yet because I want to confirm with conservancy
that this is still the right way to link to them for PayPal donations,
because it's surprising to me that the linked page doesn't mention a
project name or have a memo field.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Fri, 23 Dec 2016 11:06:02 -0500 |
parents | b173399d3635 |
children |
line wrap: on
line source
# # (c) 2014 David Soria Parra <dsp@php.net> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. import os import flask app = flask.Flask(__name__, static_url_path='') @app.route('/') def indexpage(): return flask.render_template('frontpage.html') @app.route('/<site>') def about(site=None): if not site: flask.abort(404) root = os.path.dirname(os.path.abspath(__file__)) tpath = os.path.join(root, 'templates', site, 'index.html') 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): app.debug = True if __name__ == '__main__': app.run(host='0.0.0.0')