-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
41 lines (33 loc) · 965 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
36
37
38
39
40
"""
Simple flask app
"""
import os
from flask import Flask, render_template, redirect
from flask_wtf import FlaskForm
from wtforms import StringField, SelectField
from wtforms.validators import DataRequired
app = Flask(__name__)
class GetPapersQuery(FlaskForm):
name = SelectField(
'Select Query',
choices = [('github', 'github')],
validators=[DataRequired()])
# Set the app secret key to prevent CSRF
app.secret_key = os.urandom(24)
@app.route('/', methods=['GET', 'POST'])
def root():
"""
Allow user to select an option from github/zenodo
"""
form = GetPapersQuery()
if form.validate_on_submit():
return redirect('success')
return render_template('index.html', form=form)
@app.route('/success', methods=['GET', 'POST'])
def return_results():
"""
Return results page
"""
return render_template('results.html')
if __name__ == '__main__':
app.run(debug=True, use_reloader=True)