diff --git a/app.py b/app.py index 016343b..fb7f021 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,6 @@ from flask import Flask, render_template, request, redirect, abort, url_for, make_response -import authentication -import db +from authentication import * +from db import * app = Flask(__name__) @@ -18,17 +18,17 @@ def home(): # Handle authentication related stuff in authentication.py file @app.route('/login', methods=["GET", "POST"]) def login(): - return authentication.login() + return authLogin() @app.route('/signup', methods=["GET", "POST"]) def signup(): - return authentication.signup() + return authSignup() @app.route("//decks") def allDecks(username): # would need to first find user in db, but not set up yet - # would redirect to template for Decks - return render_template('decks.html', mainDecks=db.decks.find()) + mainDecks = db.decks.find({}) + return render_template('decks.html', mainDecks=mainDecks) @app.route("//create", methods=["POST"]) def createDeck(username): diff --git a/authentication.py b/authentication.py index 544f959..e76ec9a 100644 --- a/authentication.py +++ b/authentication.py @@ -1,6 +1,6 @@ from flask import render_template, request, redirect, url_for, session from flask_login import LoginManager -import db +from db import * login_manager = LoginManager() @@ -15,14 +15,14 @@ def __init__(self, username, password, is_authenticated, is_active, is_anonymous def load_user(user_id): return User.get(user_id) -def login(): +def authLogin(): if request.method == 'POST': ## TODO: Login return "Someone pressed the login button huh, I better log you in." else: return render_template('login.html') -def signup(): +def authSignup(): if request.method == 'POST': username = request.form["username"] password = request.form["password"] diff --git a/db.py b/db.py index 265c7d5..6e1d3e5 100644 --- a/db.py +++ b/db.py @@ -1,6 +1,5 @@ from dotenv import load_dotenv import os -import pymongo from pymongo import MongoClient load_dotenv()