-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
66 lines (47 loc) · 1.68 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
from flask import Flask, render_template, request
from werkzeug.utils import secure_filename
import os
import pyrebase
from random import randint as rt
#nome+contato+tipofoto.jpg
app = Flask(__name__)
Config = {
"apiKey": "AIzaSyAXal4EpjRrRwbw3ZbOgCp37SwZhntDs6w",
"authDomain": "relacionamento-d2f2a.firebaseapp.com",
"projectId": "relacionamento-d2f2a",
"storageBucket": "relacionamento-d2f2a.appspot.com",
"databaseURL":"https://relacionamento-d2f2a-default-rtdb.firebaseio.com/",
"messagingSenderId": "315669792394",
"appId": "1:315669792394:web:ec4d1689f1e9ea682a4f73",
"measurementId": "G-1K5LLKBJNM"
}
firebase = pyrebase.initialize_app(Config)
auth = firebase.auth()
storage = firebase.storage()
UPLOAD_FOLDER="geral"
app = Flask(__name__, template_folder="templates")
app.debug=True
app.config["UPLOAD_FOLDER"]=UPLOAD_FOLDER
ALLOWED = set(['png', 'jpg', 'jpeg', 'gif'])
@app.route("/")
def index():
return render_template("curriculo.html")
@app.route('/curriculo')
def curriculo():
return render_template('curriculo.html')
@app.route('/upload', methods = ['POST'])
def upload():
if request.method == "POST":
id = rt(1,100)
id = str(id)
if "frenterg" not in request.files:
return "there is no file1 in form!"
nome = request.form["nome"]
file1 = request.files["frenterg"]
file2 = request.files["versorg"]
file3 = request.files["selfierg"]
storage.child(f"{nome}/frente.jpg").put(file1)
storage.child(f"{nome}/verso.jpg").put(file2)
storage.child(f"{nome}/selfie.jpg").put(file3)
return render_template("sucesso.html")
app.run(host='0.0.0.0', port=8080)