commit 5e67d51f4326978a45456a1e7414794e23569482
parent 71a1d6fc16fcb305f067195ebdf9d0037b90249c
Author: Nikolas Mazur <nikolas@pop-os.localdomain>
Date: Wed, 18 Jan 2023 20:16:53 -0700
Remove spagetti code
Diffstat:
M | app.py | | | 21 | ++++----------------- |
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/app.py b/app.py
@@ -1,5 +1,4 @@
import datetime
-import urllib.parse
import json
from flask import Flask, render_template, abort, redirect, url_for, request, session, jsonify;
from flask_login import UserMixin, login_user, LoginManager, login_required, logout_user, current_user;
@@ -12,19 +11,7 @@ OrganizationName = "Youth Employment Program"
app = Flask(__name__)
-# urllib.parse
-username = urllib.parse.quote_plus('user')
-password = urllib.parse.quote_plus('pass/word')
-MongoClient('mongodb://%s:%s@127.0.0.1' % (username, password))
-# urllib.parse
-
# Mongo setup
-client = MongoClient('simple-time-card.com',
- username='user',
- password='password',
- authSource='users-collection',
- authMechanism='SCRAM-SHA-256')
-
client = MongoClient('localhost', 27017)
bcrypt = Bcrypt(app)
db = client['simple_timecard_database']
@@ -42,13 +29,13 @@ app.config['SECRET_KEY'] = 'secretkey'
# Login manager
# Database collections/documents
-collection = db['users-collection'] # Make aditional user info single document/array
+users_col = db.users_collection # Make aditional user info single document/array
-collection = db['time-data-collection']
+time_col = db.time_data_collection
-collection = db['fleet-collection']
+fleet_col = db.fleet_collection
-collection = db['agreement-collection']
+agreement_col = db.agreement_collection
# Database collections/documents
# Routes