forked from snudm/dm.snu.ac.kr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
95 lines (76 loc) · 2.62 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#! /usr/bin/python2.7
# -*- coding: utf-8 -*-
from flask import Flask, redirect, render_template, url_for
from settings import APP_URL, MENUS, SERVER
from utils import read_csv_data, read_json_data, read_txt_data
app = Flask(__name__)
app.debug = SERVER['debug']
app.jinja_env.globals.update(isinstance=isinstance, str=str)
@app.route('/')
def home():
return render_template('home.html', menus=MENUS)
@app.route('/contact')
def contact():
return render_template('contact.html', menus=MENUS)
@app.route('/courses')
def courses():
return render_template('courses.html', menus=MENUS,
courses=read_json_data('courses.json'))
@app.route('/faq/')
def dummy_faq():
return redirect(url_for('datamining'))
@app.route('/faq/datamining')
def datamining():
return render_template('datamining.html',\
menus=MENUS,
datamining=read_json_data('datamining.json'))
@app.route('/faq/admission')
def admission():
return render_template('admission.html',\
menus=MENUS,
admission=read_json_data('admission.json'))
@app.route('/members')
def members():
return render_template('members.html',\
menus=MENUS,
members=read_json_data('members.json'),
alumni_phd=read_csv_data('alumni_phd.csv'),
alumni_ms=read_csv_data('alumni_ms.tsv', sep='\t'))
@app.route('/projects/')
def projects():
return redirect(url_for('faq'))
@app.route('/projects/topics')
def topics():
return render_template('topics.html',\
menus=MENUS,
topics=read_json_data('topics.json'))
@app.route('/projects/faq')
def faq():
return render_template('faq.html',\
menus=MENUS,
faq=read_json_data('faq.json'))
@app.route('/research/')
def research():
return redirect(url_for('publications'))
@app.route('/research/methods')
def methods():
return render_template('methods.html',\
menus=MENUS)
@app.route('/research/publications')
def publications():
return render_template('publications.html',\
menus=MENUS,
pub_dom_conferences=read_txt_data('pub_dom_conferences.txt'),
pub_dom_journals=read_txt_data('pub_dom_journals.txt'),
pub_int_conferences=read_txt_data('pub_int_conferences.txt'),
pub_int_journals=read_txt_data('pub_int_journals.txt'))
@app.route('/software')
def software():
return render_template('software.html',\
menus=MENUS,
software=read_json_data('software.json'))
@app.route('/~<name>')
def member(name):
return redirect('%s/~%s' % (APP_URL, name))
if __name__=='__main__':
app.run(SERVER['host'], SERVER['port'])