-
Notifications
You must be signed in to change notification settings - Fork 0
/
webapp.py
41 lines (29 loc) · 923 Bytes
/
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
# LIBRARY IMPORTS
import logging
import time
from pathlib import Path
import csv
import os
from botocore.exceptions import ClientError
from flask import Flask, render_template
# LOCAL IMPORTS
import nextlevel_config as nc
import wrapper
# GLOBAL VARIABLES
# Global Wrapper instance
WRAPPER = wrapper.Wrapper()
# Global Flask app instance
app = Flask(__name__)
@app.route('/')
def hello_world():
# Defining scope of global variables
global WRAPPER
outList = [WRAPPER.userList, WRAPPER.bucketName, WRAPPER.saveDirString, (nc.USER_FILE_NAME + nc.FILE_EXTENSION), (nc.ADDRESS_FILE_NAME + nc.FILE_EXTENSION)]
return render_template("index.html", data=outList)
def main():
# Use the GLOBAL value of WRAPPER
global WRAPPER
if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
app.run(host="0.0.0.0", port=int(os.environ.get('PORT', 5000)))
main()