hg-website /

# (c) 2014 David Soria Parra <>
# 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='')

def indexpage():
    return flask.render_template('frontpage.html')

def about(site=None):
    if not site:
    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)

if os.getenv("HGWEBSITE_DEBUG", None):
    app.debug = True

if __name__ == '__main__':