-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
35 lines (26 loc) · 839 Bytes
/
app.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
from os import path
from pathlib import Path
from flask import Flask, render_template
from flask_frozen import Freezer
template_folder = path.abspath('./wiki')
app = Flask(__name__, template_folder=template_folder)
#app.config['FREEZER_BASE_URL'] = environ.get('CI_PAGES_URL')
app.config['FREEZER_DESTINATION'] = 'public'
app.config['FREEZER_RELATIVE_URLS'] = True
app.config['FREEZER_IGNORE_MIMETYPE_WARNINGS'] = True
freezer = Freezer(app)
@app.cli.command()
def freeze():
freezer.freeze()
@app.cli.command()
def serve():
freezer.run()
@app.route('/')
def index():
return render_template('pages/index.html')
@app.route('/<page>')
def pages(page):
return render_template(str(Path('pages') / (page.lower() + '.html')))
# Main Function, Runs at http://0.0.0.0:8080
if __name__ == "__main__":
app.run(port=8080)