Mercurial > hg-website
view hgwebsite.py @ 463:4ec689699207
frontpage: use example repo from mercurial-scm.org
The rendered result looks like this:
"""
$ hg clone https://www.mercurial-
scm.org/repo/hello
"""
(It will be copied without any word breaks, the break is only visual.)
The actual repo doesn't exist yet, but really should already, because the first
thing new users will see when they try the old URL with 3.9-rc+ is a lengthy
error message that Mercurial "could not negotiate a common security protocol
(tls1.1+) with selenic.com..." Classy.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 22 Jul 2016 18:46:43 +0800 |
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')