-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun.py
54 lines (41 loc) · 1.27 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Author: Remy D <[email protected]>
Ralph Bean <[email protected]>
License: Apache 2.0
"""
import os
from flask import Flask
from flask.ext.mako import MakoTemplates, render_template
from flask.ext.compress import Compress
from flask import redirect, url_for
app = Flask(__name__)
app.template_folder = "templates"
mako = MakoTemplates(app)
Compress(app)
base_dir = os.path.split(__file__)[0]
with open(os.path.join(base_dir, 'api_key')) as key_file:
api_key = key_file.read()
@app.route('/')
def index():
return render_template('index.mak', name='mako', api_key=api_key)
@app.route('/about')
def about():
return render_template('about.mak', name='mako')
@app.route('/story')
def story():
return render_template('story.mak', name='mako')
#return redirect(url_for('static', filename='img/preso.svg'))
@app.route('/slides')
def slides():
return redirect(url_for('static', filename='img/preso.svg'))
#@app.route('/embed/embed.html')
#def embed():
# return render_template('embed/embed.html')
if __name__ == "__main__":
if 'OPENSHIFT_PYTHON_IP' in os.environ:
host = os.environ['OPENSHIFT_PYTHON_IP']
port = int(os.environ['OPENSHIFT_PYTHON_PORT'])
app.run(host=host, port=port)
else:
app.debug = True
app.run()