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)
|
|
21 tpath = os.path.join('templates', site, 'index.html')
|
|
22 if not os.path.exists(tpath):
|
|
23 flask.abort(404)
|
|
24 t = os.path.join(site, 'index.html')
|
|
25 return flask.render_template(t)
|
|
26
|
|
27
|
|
28 if os.getenv("HGWEBSITE_DEBUG", None):
|
|
29 app.debug = True
|
|
30
|
|
31 if __name__ == '__main__':
|
|
32 app.run()
|