400
|
1 #
|
|
2 # (c) 2014 David Soria Parra <dsp@php.net>
|
|
3 #
|
|
4 # This software may be used and distributed according to the terms of the
|
|
5 # GNU General Public License version 2 or any later version.
|
|
6 import os
|
|
7 import flask
|
|
8
|
|
9 app = flask.Flask(__name__)
|
|
10
|
|
11
|
|
12 @app.route('/')
|
|
13 def indexpage():
|
|
14 return flask.render_template('frontpage.html')
|
|
15
|
|
16
|
|
17 @app.route('/<site>')
|
|
18 def about(site=None):
|
|
19 if not site:
|
|
20 flask.abort(404)
|
401
|
21 root = os.path.dirname(os.path.abspath(__file__))
|
|
22 tpath = os.path.join(root, 'templates', site, 'index.html')
|
400
|
23 if not os.path.exists(tpath):
|
|
24 flask.abort(404)
|
|
25 t = os.path.join(site, 'index.html')
|
|
26 return flask.render_template(t)
|
|
27
|
|
28
|
|
29 if os.getenv("HGWEBSITE_DEBUG", None):
|
|
30 app.debug = True
|
|
31
|
|
32 if __name__ == '__main__':
|
|
33 app.run()
|