-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
executable file
·63 lines (35 loc) · 1.07 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/python3
from flask import Flask, render_template
import requests
import json
import os
import logging
import compile_file
app = Flask(__name__)
app.config['TEMPLATES_AUTO_RELOAD'] = True
app.logger.setLevel(logging.DEBUG)
@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@app.route('/')
def index():
return render_template('index.html')
@app.route('/projects')
def projects():
return render_template('/hugo/projects/public/index.html')
#@app.route('/projects/<path:subpath>')
#def handle_project(subpath):
# # subpath contains the part of the URL after projects/
# subpathmd = subpath
# if not subpath.endswith('.md'): subpathmd += '.md'
#
# app.logger.debug(subpath)
#
# file_path = os.path.join('projects/', subpathmd)
#
# if os.path.exists(file_path):
# compile_file.compile_file(subpathmd)
# app.logger.debug(subpathmd)
# return render_template(f'projects/{subpath}.html')
# else:
# return render_template('didntwork.html')