-
Notifications
You must be signed in to change notification settings - Fork 0
/
webapp.py
54 lines (39 loc) · 1.42 KB
/
webapp.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
from flask import Flask, redirect, url_for, session, request, jsonify, Markup
from flask import render_template
from flask_mail import Mail, Message
import csv
import pprint
import os
app = Flask(__name__)
app.debug = False #Change this to False for production
app.secret_key = os.environ['SECRET_KEY'] #used to sign session cookies
app.config['MAIL_SERVER']='smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = 'blake.c.robinson.xvi@gmail.com'
app.config['MAIL_PASSWORD'] = os.environ['MAIL_PASSWORD']
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True
mail=Mail(app)
@app.route('/')
def Page1():
return render_template('Page1.html')
@app.route('/Page2')
def Page2():
return render_template('Page2.html')
@app.route('/next1',methods=["POST","GET"])
def rendernext1():
#messg = request.form['data']
return render_template('Page2.html')
@app.route('/next2',methods=["POST","GET"])
def rendernext2():
messg = "'" + str(request.form['data']) + "'"
msg = Message('User Dats', sender = 'blake.c.robinson.xvi@gmail.com', recipients = ['blake.c.robinson.xvi@gmail.com'])
msg.attach("data.csv", "data/csv" , messg )
mail.send(msg)
return render_template('Page2.html' , sent="yes")
@app.route('/home',methods=["POST","GET"])
def renderhome():
return render_template('Page1.html')
if __name__ == '__main__':
os.system("echo json(array) > file")
app.run()