diff --git a/app.py b/app.py index 11b4d98..dc02270 100644 --- a/app.py +++ b/app.py @@ -14,16 +14,20 @@ app.config.from_object(DevelopmentConfig) # Use DevelopmentConfig or Production cache = Cache(app, config={'CACHE_TYPE': 'SimpleCache'}) @app.route('/') -@cache.cached(timeout=60) # cache for 120 seconds -def home(): +def index(): # If the user is logged in, redirect to a protected page like /accounts if session.get('logged_in'): - base_url = app.config['BASE_URL'] # Access base_url from the config - all_accounts = get_user_accounts(base_url, session['auth_credentials']) - current_month_accounts = filter_accounts_current_month(all_accounts) - return render_template('home.html', username=session['username'], accounts=get_user_accounts(base_url, session['auth_credentials']), current_month_accounts=current_month_accounts) + return redirect(url_for('home')) return render_template('index.html') +@app.route('/home') +@cache.cached(timeout=60) # cache for 120 seconds +def home(): + base_url = app.config['BASE_URL'] # Access base_url from the config + all_accounts = get_user_accounts(base_url, session['auth_credentials']) + current_month_accounts = filter_accounts_current_month(all_accounts) + return render_template('home.html', username=session['username'], accounts=get_user_accounts(base_url, session['auth_credentials']), current_month_accounts=current_month_accounts) + @app.route('/login', methods=['POST']) def login(): username = request.form['username'] diff --git a/lib/__pycache__/reqs.cpython-310.pyc b/lib/__pycache__/reqs.cpython-310.pyc index d8d9a49..7639ac1 100644 Binary files a/lib/__pycache__/reqs.cpython-310.pyc and b/lib/__pycache__/reqs.cpython-310.pyc differ